How do I dynmaically replace a paramater in a pixel that is to placed on our site, with a value from our data layer? For example: https://www.foo.com:82/ats.php?cid=12&uid=[userid] I tried replacing [userid] with @@visID@@ with no luck.

clif_bate
Not applicable
clif_bate
From Chrome developer tool console I can see DTKR.vis.visID has an actual value, but I'm not sure how to pull it in.
4 REPLIES 4

How do I dynmaically replace a paramater in a pixel that is to placed on our site, with a value from our data layer? For example: https://www.foo.com:82/ats.php?cid=12&uid=[userid] I tried replacing [userid] with @@visID@@ with no luck.

jared_hislop
Employee Emeritus
jared_hislop
Hey Clif, First off, I am not fully aware of your set up so forgive me if I am telling you something you already know. The double "@@" sign is used to pull in variables from the utag_data object. The visID seems to be within the DTKR object so this wouldn't necessarily work. You can add "DTKR.vis.visID" as a JavaScript Page Variable Data Source. This can be done under the Data Sources tab within the UI. Then you can use this syntax: "@@js_page.DTKR.vis.visID@@" Once you add the DTKR.vis.visID as a Data Source the double "@@" sign will be able to pull the correct value. Hope this helps and feel free to reach out with more questions.

How do I dynmaically replace a paramater in a pixel that is to placed on our site, with a value from our data layer? For example: https://www.foo.com:82/ats.php?cid=12&uid=[userid] I tried replacing [userid] with @@visID@@ with no luck.

son_hoang
Employee Emeritus
son_hoang
Hi Clif, There are a couple of steps to do this: - The system can only use variables that have been defined for use. So the first step is to add it as a new Data Source, with the parameters below: Name = DTKR.vis.visID Type = JavaScript Page Variable Description = Anything useful for you to remember what it is. - Then for the part of the pixel request you want to be dynamic, replace it with this: @@js_page.DTKR.vis.visID@@ So in this use case specifically, it should look like this: //www.foo.com:82/ats.php?cid=12&uid=@@js_page.DTKR.vis.visID@@ That should work. If it doesn't, please contact your account manager so we can work with you on this.

How do I dynmaically replace a paramater in a pixel that is to placed on our site, with a value from our data layer? For example: https://www.foo.com:82/ats.php?cid=12&uid=[userid] I tried replacing [userid] with @@visID@@ with no luck.

walter_gold
Employee Emeritus
walter_gold
Also, be aware that there is automatic normalization of data sources by lower casing(this is something we are considering removing as it seems to cause unnecessary confusion). DTKR.vis.visID becomes js_page.dtkr.vis.visid in the data object. You may need to reference it as @@js_page.dtkr.vis.visid@@
Highlighted

How do I dynmaically replace a paramater in a pixel that is to placed on our site, with a value from our data layer? For example: https://www.foo.com:82/ats.php?cid=12&uid=[userid] I tried replacing [userid] with @@visID@@ with no luck.

son_hoang
Employee Emeritus
son_hoang
Hmm that's true, although in my brief test, keeping the capitalization seemed to work fine. Something to keep in mind though, for sure.