Last active
April 24, 2018 11:33
-
-
Save jsn789/5460b7a7f884a96553d4570263f129ef to your computer and use it in GitHub Desktop.
GTM Custom JavaScript - Error Handling. Used in a case where a custom js variable returns a value for a Custom Dimension. Used it for temporary troubleshooting.
This file contains 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() { | |
try { | |
// Option1 or Option2 | |
cd = 'undefined' | |
if({{customVarOption1orOption2}} == 1){ | |
cd = '-'; //option1 | |
} | |
else if({{customVarOption1orOption2}} == 2){ | |
cd = '-'; // option2 | |
} | |
return cd; | |
}catch(e) { | |
return cd = e.message; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment