- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
08-22-2018 07:08 AM
Hi guys,
We use a querystring parameter for our campaign parameters which looks like xcmp=source_medium_additionalInformation
This xcmp parameter is already saved as a Querystring-Parameter in Tealium iQ. But now I would like to take only the last part of this variable (in this case additionalInformation) and save this in a new variable "last_part" to be able to send only this information to Google Analytics.
I tried a Javascript-Extension:
var xcmp = utag.data["qp.xcmp"].split('_');
var last_part = xcmp[xcmp.length-1];
if (xcmp.length >= 1){
utag.link({
"last_part" : last_part
});
}
as soon as I enter utag.link to this Javascript Extension my page isn't loaded and Tealium drives crazy.
Can you please help me to solve this problem?
Thanks,
Sophie
Solved! Go to Solution.
08-22-2018 12:48 PM - last edited on 08-23-2018 12:32 PM by kathleen_jo
Hi @SKammerlocher,
The problem you're experiencing is that the utag.link function initiates Tealium's event processing, but if you've got an extension that uses it, you'll generally end up in an infinite loop.
In the case below, you'll want the code to read:
var xcmp = b["qp.xcmp"].split('_'); if (xcmp.length >= 1){ b.last_part = xcmp[xcmp.length-1]; }
The first change is to replace the reference to utag.data to a reference to the b variable, which in an event-scoped extension (Before Load Rules, After Load Rules or Tag-Scoped) will contain the current state of the UDO. The second change then is to use this reference to the UDO to write the last element of the array to the last_part variable in the UDO, which will make it available to subsequent extensions, and to tags (provided you've created the last_part variable within Tealium IQ's UDO).
Hope that helps, give me a shout if you need any further detail.
08-24-2018 01:56 AM
@UnknownJ thank you so much for your help. It works perfectly!!!!!
Copyright All Rights Reserved © 2008-2023