Force all Variables to Lower Case in Adobe Analytics

If you have been working with Adobe Analytics for some time you probably have run into the situation where tracking is breaking due to the fact that you have mixed case values co-mingled with uppercase/lowercase/etc. This blog posting will provide you with the necessary snippet of JavaScript that you can embed in your appMeasurement library or s_code.js file to not run into this issue ever again.

Now some of you might be thinking that it might be easy to just take your variables one by one and put the below in:

s.propXX = foobar.toLowerCase();

This works only when you have a small implementation and arent adding, removing, tweaking variables. However, if you are doing this, you need something more scalable. Enter the lowercase plugin:

for(var a=1;a<=100;a++)s[“prop”+a]&&(s[“prop”+a].toLowerCase().replace(/^d=/,”D=”)),s[“eVar”+a]&&(s[“eVar”+a]=s[“eVar”+a].toLowerCase().replace(/^d=/,”D=”)),a<=5&&s[“hier”+a]&&(s[“hier”+a]=s[“hier”+a].toLowerCase().replace(/^d=/,”D=”));for(var b=[“products”,”pageName”,”channel”,”campaign”],a=0;a<b.length;a++)s[b[a]]&&(s[b[a]=s[b[a]].toLowerCase().replace(/^d=/,”D=”));

This plugin will take your props, eVars, hierarchy, pageName, channel and campaign variables and force them to lowercase without you having to do anything. If you have more than 100 eVars, I would suggest updating the a<=100 with whatever your number is so that you cover all of your bases.