- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
05-12-2016 05:40 AM
Hi There
I want to make sure a specific Tag only gets executed after another Tag already is.
Greetings
Solved! Go to Solution.
05-12-2016 07:10 AM - last edited on 05-12-2016 10:37 AM by kathleen_jo
Hi @kay_lehmann,
Good to see you active on the community :-)
There isn't a built-in feature to do this, but you can achieve it by using a JavaScript extension.
Example scenario: you want to fire a tag (UID 23 in IQ) first and then fire another one (UID 49) when this has completed.
Steps:
1. Create a JS extension scoped to tag 23 with the following contents:
window.utag_post_send_q = window.utag_post_send_q || []; window.utag_post_send_q.push({event:a, data:b, uids:['49']});
2. Create a second JS extension scoped to "All Tags", but change the execution order drop-down to "After Tags". This will then run after all tags have completed. The contents of this extension should be:
// declared for later use var evt_obj; // take items from the front of the queue and fire a utag.track call for each one while (evt_obj = window.utag_post_send_q.shift()) { // utag.track accepts: event type (view/link), data object, object containing: callback function (null if not required), array of tag UIDs utag.track(evt_obj.event, evt_obj.data, {cb:null, uids:evt_obj.uids}); }
Now, tag #23 will run when the page loads, and as soon as all tags have finished sending, tag #49 will load, with the data that was originally passed to tag #23.
Please be aware that this solution is untested, but it should work. It's recommended to have the latest utag version to use this, but v4.36 is the minimum.
05-31-2016 03:18 AM
Copyright All Rights Reserved © 2008-2023