Skip to content Skip to sidebar Skip to footer

Removing Query Strings From The Url Using Google Tag Manager

I'm trying to tidy up the analysis in Google Analytics by removing query strings from the URL, but this has split into three requirements; I want to remove query strings from bein

Solution 1:

If you update the page location in the DOM with the result of a function like this (window.location={{clean URL}}) you would naturally cause a lot of problems by causing reloading.

If you use the result of this function to set UA parameters relating to page and referrer, then it affects nothing that isn't related to those parameters in the hits. For example, you would want to clean the page field which is not just on page hits:

enter image description here

Things like utm parameters are extracted from normal DOM/BOM (for example window.location) and sent as separate parameters and are not calculated from page related parameters later on the server side unless you are doing extraction yourself in Analytic's custom filters.

Solution 2:

Also you may use Google Analytics built-in mechanics to drop URL parameters through setting up Exclude URL Query Parameters in View settings. Docs are here: https://support.google.com/analytics/answer/1010249?hl=en No JS Required.

Post a Comment for "Removing Query Strings From The Url Using Google Tag Manager"