Created
May 1, 2025 14:47
-
-
Save brunogama/8d1c687e95f72399e6bf1bbd1ef21c13 to your computer and use it in GitHub Desktop.
Revisions
-
brunogama created this gist
May 1, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // Remove tracking utm query // Convert the iterator to an array to avoid modification issues let keys = Array.from(ctx.url.searchParams.keys()); // Loop through all parameters keys.forEach(function(key) { // Check for both utm with and without underscore, same for uta if (key === "utm" || key.startsWith("utm_") || key === "uta" || key.startsWith("uta_")) { ctx.url.searchParams.delete(key); } }); // If needed: Apply the changes to the current URL // window.history.replaceState(null, '', ctx.url.toString());