- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
12-21-2015 10:02 AM
Hi folks - I can't seem to find an answer to this issue, which I'd probably normally try to write a bit of script to handle:
I have an affiliate network partnered with an agency sending us URLs to our landing pages like so:
subs.domain.com/index.php?cid1=a/b/c/[AFFILIATEID]/d/e/f/g/[PARTNERID]/h/i
I know how to grab the cid1 value, but how can I split the value by the forward slashes in order to grab the AFFILIATEID and PARTNERID values?
12-21-2015 12:20 PM
You can solve this with some JavaScript, Data Sources and Mappings. Your use case is similar to the Tealium Pathname Tokenizer, however your data is within a querystirng parameter and not within the URL pathname. Here is one way to solve your use case.
1) Add some data sources to your TiQ Data Layer:
"_cid1_0","UDO Variable","Token 0 from querystring parameter cid","" "_cid1_1","UDO Variable","Token 1 from querystring parameter cid","" "_cid1_2","UDO Variable","Token 2 from querystring parameter cid","" "_cid1_3","UDO Variable","Token 3 from querystring parameter cid","" "_cid1_4","UDO Variable","Token 4 from querystring parameter cid","" "_cid1_5","UDO Variable","Token 5 from querystring parameter cid","" "_cid1_6","UDO Variable","Token 6 from querystring parameter cid","" "_cid1_7","UDO Variable","Token 7 from querystring parameter cid","" "_cid1_8","UDO Variable","Token 8 from querystring parameter cid","" "_cid1_9","UDO Variable","Token 9 from querystring parameter cid","" "_cid1_10","UDO Variable","Token 10 from querystring parameter cid",""
2) Map the Token(s) to your tag. In this example I am mapping to Google Analytics, but you could use any tag vendor in the marketplace.
3) Add the extension to do the Tokenize Magic
if(typeof b['qp.cid1'] !== 'undefined'){ var d = b['qp.cid1'].split('/'); for (var c = 0; c < d.length; c++) { b['_cid1_' + c] = (typeof d[c] != 'undefined') ? d[c] : ''; } }
4) Test. To test we can look at the Data Layer in the console and we can also look at the outbound data for Google Analytics.
This is just one way to solve your use case. Let us know how this works out for you.
Happy Tagging!
Brian
06-27-2016 06:21 AM
Highly delayed, but working on this implementation now. Will update on success of solution.
06-27-2016 10:27 AM
No worries @redfuel318! We look forward to hearing how it turned out. Keep us posted.
Copyright All Rights Reserved © 2008-2023