- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
09-19-2017 02:31 PM - edited 09-19-2017 04:32 PM
Issue:
Step 1: I have accessed page www.test.com?oid=test1
Step 2: The page has link test2 with href ="/test2.html?oid=test2"
When I click on 'test2' link the qp parameter of page (oid=test1) is getting passed, rather than the one that is being set on link.
Requirement: I want oid = test2 to get passed, when I click on 'test2' link
Solved! Go to Solution.
09-20-2017 08:55 AM - edited 09-21-2017 07:09 AM
Hi @veerender_reddy, what I would do is create another data variable (UDO variable type, not qp) that grabs that part of the href string. Because the link is on the same page, clicking a link that contains an oid the browser does not recognize this as having or updating the querystring.
What you need to do is treat it as a string variable and split out that part using a jQuery onHandler extension mapped to your new variable (and narrow the conditions as needed), and use something like:
$(this).attr('href').split('oid=')[1].split('&')[0];
09-20-2017 11:59 AM - last edited on 09-20-2017 12:57 PM by kathleen_jo
Is there any way, where I can use 'qp' param and override the 'qp' param set on the page, when a link click event is triggered, @STerjeson?
09-20-2017 01:08 PM
@veerender_reddy Because querystrings are basically a "browser functionality" element, it is not best practice to hijack them for non-standard use. It can create unexpected problems in the user experience. It is also not possible to select a qp. variable in the interface to set a new data value in that way.
That being said, if its mission critical to hijack the functionality to do this, you could do so with some custom scripting in a javascript extension, I just would not recommend doing that when its so much easier to handle by creating and using a new data variable.
09-20-2017 01:32 PM
09-20-2017 02:16 PM
@STerjeson, In addition to what Veerender mentioned.
We need to send 2 tags as below.
1. Page view tag with "oid=test1" from the querystring on the page --> sent to a propX
2. Link click tag with "oid=test2" from the href of the link --> Sent to the same propX.
So, does it work fine, if I have 2 datalayer parameters(one qp & one UDO) and mapped to single propX ?
If so, would I still get page "oid=test1" on a link click tag(2nd case) when there is no "oid" in href of the link ?
09-20-2017 02:34 PM
@ravi_thati , @veerender_reddy I would create a consolidated variable that checks to see if the secondary value is populated and use that instead of the default. One way to do that is outlined below.
Variables:
oid_prop -- UDO variable to map to tag propX
oid_href -- UDO variable for link click value
qp.oid -- original URL qp value
2 Set Data extensions,
Then just have the consolidated oid_prop variable mapped in the tag as a single point of reference. This could probably be refined, but hopefully a starting point for you.
09-20-2017 02:46 PM
@STerjeson - as we have 16 such query params, I might have to think abit about the solutions you gave and choose the best one suitable for our app.
Thank you very much for the suggestions, they are really helpful !
09-20-2017 02:54 PM
@ravi_thati One other option would be to just try setting in the js extension script (as part of the broader link call):
utag.data["qp.oid"]="12345";
My only concern with that approach is the utag.data reprocessing sequence with a link or view event. One of the Tealium engineers might be better equipped to answer that more defintitively. I don't want to see your custom qp.oid overwritten when the utag.data reloads and may grab the querystring values again. If utag only pulls the querystring once on the initial call, then it might not be a problem. Its just not something I have directly tested before.
09-20-2017 03:01 PM
You are right, utag pulls the querystring values each time a tag fires. But anyway the extension runs after that, so there are no issues with it. I did a quick test with the JS extension approach and it seems to be working as per our requirement. I would probably go with that approach unless I see any other issues in my testing.
Thanks !
09-21-2017 01:07 AM
Copyright All Rights Reserved © 2008-2023