- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
04-08-2015 05:39 AM
04-08-2015 05:55 AM - last edited on 10-08-2015 11:31 AM by kathleen_jo
It's possible to do this, but only using some custom JavaScript code. There are 2 steps, and we can put both of them in a single JavaScript Code extension.
1) Fire the single tag. You can do this using the syntax utag.view({ ..data.. }, [ tag UID ]);
There is some more information here How to trigger exclusively one tag
You could use a setTimeout or an event listener on the onLoad event to fire the utag.view();
2) Suppress the normal firing.
If you put "return false;" in a JavaScript Code extension, then the tag that it is scoped to will not execute.
04-08-2015 06:11 AM - last edited on 10-08-2015 11:26 AM by kathleen_jo
Also, the "dom_complete" flag can be used to delay all tags until the load event, but this can't be controlled on a tag-by-tag basis.
To use this flag, put the following in a preloader scoped extension:
window.utag_cfg_ovrd = window.utag_cfg_ovrd || {};
window.utag_cfg_ovrd.dom_complete = true;
04-08-2015 10:11 AM
04-15-2015 02:17 AM
08-25-2015 04:16 PM - last edited on 10-08-2015 11:29 AM by kathleen_jo
For future users looking at this question, here is an option that will work on a tag-by-tag basis.
1) The following code needs to be placed in a javascript extension
2) any tag(s) that you would like to trigger at onload instead of dom ready should be scoped to this extension
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
};
}
}
utag.onload_flag = utag.onload_flag||{};
if(!utag.onload_flag[id]) {
if(document.readyState!="complete") {
addLoadEvent(function() {
utag.view(utag_data,null,[id]);
});
return false;
}
utag.onload_flag[id] = 1;
}
02-02-2016 02:04 AM - last edited on 02-08-2016 02:31 PM by kathleen_jo
Hi @stuart_roskelle,
Can this be modified to be a timeDelay (5 seconds, 15 seconds and 30 seconds) than onLoad?
e.g.
Tag1 fires on page2 after 15 seconds
Tag2 fires on page2 after 30 seconds
Tag3 fires on page1 after 5 seconds
Tag4 fires on page1 after 30 seconds and so on... another 10-20 tags of simialr config.
Thanks
Sam
02-08-2016 02:53 PM
02-08-2016 11:34 PM - last edited on 02-09-2016 09:32 AM by kathleen_jo
Hi @stuart_roskelle,
Thanks, I thought so, I'll raise a ticket.
Thanks
Samrat
07-15-2018 02:46 PM - last edited on 07-16-2018 07:49 AM by kathleen_jo
Hi @stuart_roskelle, with your solution above, does 'id' needs to be defined?
06-30-2020 04:11 PM
Hi - just wondering if this is still the recommended way to delay tags until onLoad?
Copyright All Rights Reserved © 2008-2023