Removing Unwanted Query Parameters from Login URL

Hello Webflow Community,

I’m encountering an issue on my homepage where clicking the “Login” button directs users to https://xxx.abc.tech/?_gl=1*6p3irf*_gcl_au*OTUyNDk1ODcxLjE3Mzg1MjQwNDA instead of the clean URL https://xxx.abc.tech. It appears that Google Analytics or Tag Manager dynamically appends these query parameters.

To resolve this, I attempted to implement the following custom code within the <body> tag:

<script>
(function() {
    var url = new URL(window.location.href);
    var paramsToRemove = ["_gl", "_gcl_au", "gclid", "utm_source", "utm_medium"];
    paramsToRemove.forEach(param => url.searchParams.delete(param));
    if (window.location.search !== url.search) {
        window.history.replaceState({}, document.title, url.pathname + url.search);
    }
})();
</script>

But this code isn't working. Please help.

Hey Prashant,

What login button?
You’ll need to share your published site link, readonly designer link, and show clearly how to reproduce the problem you’re having.

When clicking on the login button link the default link is this - https://app.sibros.tech/ but on page load, it changes to https://app.sibros.tech/?_gl=1*18010m3*_gcl_au*MTI5ODEyODQ4LjE3MzY5MjEwMzg.

That is not a Webflow site?