Created
January 17, 2017 00:33
-
-
Save wmcraver/3b24c3cb080648479c45c5c3aab97586 to your computer and use it in GitHub Desktop.
Javascript extension for Tealium to capitalize the first letter of a section name so that they are consistent in the system.
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
sectionName = "word word word"; // The data layer value goes here. Should look like: best western rewards. | |
sectionNameSplit = sectionName.split(" "); // Split the sectionName into an array -- separator is a space. | |
for (i = 0; i < sectionNameSplit.length; i++) { | |
sectionNameSplit[i] = sectionNameSplit[i].substring(0,1).toUpperCase() + sectionNameSplit[i].substring(1,sectionNameSplit[i].length); | |
} | |
sectionName = sectionNameSplit.join(" "); // "Word Word Word" stored back in sectionName | |
// Change sectionName to value being sent to Analytics system from Tealium. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment