Expand my Community achievements bar.

Check out the November edition of the Analytics Community Lens newsletter to see what's been trending in the last two months!
SOLVED

To Lower Case Values

Avatar

Level 8

Hello Adobe Community,

IIs there a simple way to get all values to lower case ? spetially for the SDK ? like a plug in or something ?

Cheers !

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Here's a new AA plugIn function that should do the trick.

Drop this function into your aa custom code with your other plugins.

//AA Plugin - forceLowerCaseMulti 1.0.0 - Stewart Schilling : Search Discovery Inc. : 7/15/2018

//When called, all s.props, s.eVars, s.listVars, s.pageName, s.channel, s.hier, and s.products

//values will be forced to lower case.

//The 's' object must be passed into the function.

s.forceLowerCaseMulti = function(s) {

  function filterS(key){

      var keyMatch=new RegExp(/(^eVar[0-9].*)|(^prop[0-9].*)|(^hier[1-5].*)|(^list[1-3].*)|(^pageName$)|(^channel)|(^products$)/);

      return (key.match(keyMatch));

  };

  Object.keys(s).filter(filterS).forEach(function(key){

    if (typeof s[key]==="string"){

        s[key] = s[key].toLowerCase();

    }

  });

};

Call it at the end of your doPlugins function like so:

s.forceLowerCaseMulti(s);

View solution in original post

4 Replies

Avatar

Employee Advisor

Processing Rules would be your best bet here and unfortunately they don't have a toLowerCase style functionality. Although I think that's a great forum idea for you to submit (hint hint).

For web:

DTM/Launch have the ability to set clean text and lower case in data elements, which I would recommend.

You could consider coding a solution in doPlugins that checks through the variables in the s object and applies toLowerCase to them one-by-one. I'm not familiar with a plugin that does this automatically.

For app:

I'm similarly not aware of a 'plugin' for the SDK that does this. Sounds like it might be worth your while to build one though.

Hope that helps!

Avatar

Correct answer by
Community Advisor

Here's a new AA plugIn function that should do the trick.

Drop this function into your aa custom code with your other plugins.

//AA Plugin - forceLowerCaseMulti 1.0.0 - Stewart Schilling : Search Discovery Inc. : 7/15/2018

//When called, all s.props, s.eVars, s.listVars, s.pageName, s.channel, s.hier, and s.products

//values will be forced to lower case.

//The 's' object must be passed into the function.

s.forceLowerCaseMulti = function(s) {

  function filterS(key){

      var keyMatch=new RegExp(/(^eVar[0-9].*)|(^prop[0-9].*)|(^hier[1-5].*)|(^list[1-3].*)|(^pageName$)|(^channel)|(^products$)/);

      return (key.match(keyMatch));

  };

  Object.keys(s).filter(filterS).forEach(function(key){

    if (typeof s[key]==="string"){

        s[key] = s[key].toLowerCase();

    }

  });

};

Call it at the end of your doPlugins function like so:

s.forceLowerCaseMulti(s);

Avatar

Level 1

Hi

We used your code I think its lowering the dynamic variables as well

for example  - we are duplicating evar1 = prop1 and when we see the values pass in the debugger its showing as evar1 - d=c1. "D" has to be in uppercase. When seeing in reports we see d=c1 as a value begin pass and not the duplicate value.

Please suggest how we can overwrite it.

Thanks

Shirin