Created
June 20, 2025 08:57
-
-
Save mbaersch/1df204eceda48100457e7cc52a70b4e6 to your computer and use it in GitHub Desktop.
Transforms GTM HTML code with variables for testing in console
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 gtmTagCode(fCode, delimiter="'", replacement="", run=false){ | |
if (replacement && replacement != "") { | |
fCode = fCode.replace(/{{.*}}/gi, replacement) | |
} else | |
fCode = fCode.replace(/({{|}})/gi, delimiter) | |
if (run===true) eval(fCode); else console.log(fCode) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment