Highlighted

Using the Javascript Extension to map a data source variable auto escapes value when mapped to the MediaForge extension.

Silver Contributor
Silver Contributor
Is there a way to prevent auto escaping of Javascript variables added to the utag.data object when passed to the Mediaforge Extension. For example, I have generated utag.data._prodId with the value Segment1,0,CA,YNG486926_2011 I know that is the value saved to the utag.data object because I can access it from the console in my browser. However, when I add it to my media forge tag it is escaping the value as so: http://tags.mediaforge.com/pix/359?type=pos&prodID=Segment1%2C0%2CCA%2CYNG486926_2011 How do I prevent this. Thanks for your help, Greg
4 REPLIES 4
Highlighted

Using the Javascript Extension to map a data source variable auto escapes value when mapped to the MediaForge extension.

Tealium Employee
Hi Greg, Since the data is passed as part of the URL string we need to run the value through the encodeURIComponent() function which you can read about here: http://www.w3schools.com/jsref/jsref_encodeuricomponent.asp. If you need to remove this then you'll need to manually update the template and change line 19 from: c.push(e[f]+u.kvp_delim+encodeURIComponent(b[d])) to: c.push(e[f]+u.kvp_delim+b[d]) You just need to be careful with this because if any value is being passed with URL specific characters like "?" or "&" then it can possible alter or worse break the URL being called.
Highlighted

Using the Javascript Extension to map a data source variable auto escapes value when mapped to the MediaForge extension.

Silver Contributor
Silver Contributor
Hi Dan, Thanks for your answer. Could you please tell me how I can update the template manually and which template you are talking about? Thanks again, Greg
Highlighted

Using the Javascript Extension to map a data source variable auto escapes value when mapped to the MediaForge extension.

Tealium Employee
Hi Greg, You can only do this as long as you have the user permissions to Manage Templates so hopefully you can access this... - Click your email address in the upper-right corner of TealiumIQ. - Choose "Manage Templates". - When the Template Config modal appears, choose "MediaFORGE from the drop-down. - On line 19 change from: c.push(e[f]+u.kvp_delim+encodeURIComponent(b[d])) to: c.push(e[f]+u.kvp_delim+b[d]) - Click "Save Profile Template". - Click "Close" once the save modal disappears. - Save/Publish the change. If you are uncomfortable making this change, please reach out to your Account Manager with the account and profile where this change is needed and they will be able to complete this for you or loop in a Solutions Engineer.
Highlighted

Using the Javascript Extension to map a data source variable auto escapes value when mapped to the MediaForge extension.

Silver Contributor
Silver Contributor
Great this is just what I was looking for thank you!