String in uppercase
1 2 3 4 5 | var StringLowerCase = “{{string in lowercase}}”;var StringUpperCase = StringLowerCase.toUpperCase();;return StringUpperCase;} |
Custom variables (especially Custom JavaScript Variables) of Google Tag Manager are a powerful tool to eliminate tracking issues. Custom variables require a single anonymous function that returns a value. Custom JavaScript Variables often use other Tag Manager variables as input and return a modified version of that as output.
In simple terms, you can use individual JavaScript variables to utilize other variables, process or manipulate them with JavaScript, and convert and output them into a new variable.
A small list of additional variables for use in GTM
1 2 3 4 5 6 7 8 9 | {var StringInclUmlaute = “{{String with umlauts}}”;var LowerCaseIncUmlaute = StringInclUmlaute.toLowerCase();LowerCaseExcUmlaute = LowerCaseIncUmlaute.replace(/ä/g, ‘ae’);LowerCaseExcUmlaute = LowerCaseExcUmlaute.replace(/ö/g, ‘oe’);LowerCaseExcUmlaute = LowerCaseExcUmlaute.replace(/ü/g, ‘ue’);return LowerCaseExcUmlaute;} |