Highlighted

Replacing string with Set Data Values extension using JS code method

Silver Contributor
Silver Contributor

Hi guys,

I am trying to replace a specific string using the Set Data values extension. I think the code I am using is correct but it doesn't seem to be working.

The JS code that I am using to replace the string is as follow: 

b['page_name'].replace('undefined','abcd');

Any ideas why the above isn't working?

Thanks,
Max

6 REPLIES 6
Highlighted

Replacing string with Set Data Values extension using JS code method

Tealium Employee

Hi Max,

Is page_name "undefined" or undefined?

 

If it is a String then your code will work, however if page_name is simply undefined then you are probably looking for:

Screenshot 2020-10-13 at 12.32.47.png

Or alternatively

Screenshot 2020-10-13 at 12.37.04.png

 

Thanks,

 

Matt

Highlighted

Replacing string with Set Data Values extension using JS code method

Silver Contributor
Silver Contributor

Hi Matt (@malexander),

Thanks for your response!

The page name shows the string "undefined" e.g "undefined:abc:products:shoes". This is shown in our analytics reporting platform.

Cheers,
Max

Highlighted

Replacing string with Set Data Values extension using JS code method

Tealium Employee

Hi Max (@max_wong),

In that case I see no issue with your approach, and have tested that it works based on your supplied code. My suggestion would be to raise a support ticket with support@tealium.com and share with them a live example (e.g. URL), so they can identify why the value for page_name is not being updated.

Thanks,

Matt

Highlighted

Replacing string with Set Data Values extension using JS code method

Tealium Employee

@max_wong Can you post a screenshot of the extension?

Highlighted

Replacing string with Set Data Values extension using JS code method

Silver Contributor
Silver Contributor

@david_bird - Sure. Please find the below for your viewing:

undefined string.pngThanks,
Max

Highlighted

Replacing string with Set Data Values extension using JS code method

Gold Contributor
Gold Contributor

Hi @max_wong ,

       Were you able to debug the condition you have given for the set data values ?

Try putting debugger in that particular set datavalues in the utag.js file in your website and check whether your condition is getting passed ?

Debugger.JPG

 

Thanks,

VJ

           

Its Not Who I am Underneath, but What I Do That Defines Me