Removing Query Strings From The Url Using Google Tag Manager
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:
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"