Created
February 26, 2022 16:16
-
-
Save ericakfranz/f4eb0f109d103e62749f073c6312c497 to your computer and use it in GitHub Desktop.
Check if the URL already contains a query argument and choose whether to output a '?' or '&' character before any other string.
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 characters
function mySep() { | |
var url = window.location.href; | |
if (url.indexOf('?') != -1) { | |
var sep = '&'; | |
} else var sep = '?'; | |
console.log(sep); | |
return sep; | |
} | |
mySep(); | |
const addSep = mySep(); | |
// custom smart tag in OM | |
document.addEventListener('om.Dtr.init', function (event) { | |
event.detail.Dtr.setCustomVariable('separator', addSep); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment