Skip to content

Instantly share code, notes, and snippets.

@SNemzer
SNemzer / parameterWhitelist.js
Created May 24, 2018 13:26
Custom JS variable for GTM of parameters not to remove
function(){
return ["utm_medium",
"utm_source",
"utm_campaign",
"utm_term",
"utm_content",
"gclid",
"search"]
}
@SNemzer
SNemzer / pii_removal_tag.html
Last active June 7, 2021 11:06
Custom HTML tag for GTM to strip PII from titles and URLs
<script>
//Extract Parameters into array
function extractParams() {
var urlParams = {},
match,
search = /([^&=]+)=?([^&]*)/g,
query = window.location.search.substring(1);
while (match = search.exec(query)) {
urlParams[match[1]] = match[2];
}