Can I queue events as long as Tealium is not loaded ?

Bronze Contributor
Bronze Contributor

Hi,

I am wondering if a built-in mechanism exists in Tealium to queue events. Much like Google Analytics, I would love to be able to just add events to a queue (a simple JS object array) that Tealium will pick up and process once it is fully loaded.

On our sites, we have stuff happening before Tealium is loaded.  And we want to track those things, but we can't do a utag.link() for example, because utag doesn't exist yet at that point. We can of course write our own queue logic, but I was wondering if something like that is available out of the box.

 

Thank you !

Filip

7 REPLIES 7

Can I queue events as long as Tealium is not loaded ?

Gold Contributor
Gold Contributor

Hi @filip_lejon

I would like to have that as well, but I think there is no "out of the box" solution from tealium. I created a queue logic on my own. So I gatter all events in a JS Object Array, and on DOM Ready I fire utag.link with the values in the JS Object (if it's not empty). 

Kind Regards

Patrick

Can I queue events as long as Tealium is not loaded ?

Bronze Contributor
Bronze Contributor
Yeah, we did the same in the meantime, as we also suspected there not being a Tealium solution at hand already. Still, would be nice to have, so I would appreciate an answer from Tealium to indicate if this is coming or not.

Thanks for the reply !

Can I queue events as long as Tealium is not loaded ?

Gold Contributor
Gold Contributor

If not, maybe it's a post on "tealium product ideas" worth ;)

https://community.tealiumiq.com/t5/Product-Ideas/idb-p/product-ideas

Can I queue events as long as Tealium is not loaded ?

Employee Emeritus

Hello @PatrickHegnauer and @filip_lejon I am trying to get @adrian_browning here to address this post. He is quite the busy man, however, so give me a sec. #ThankYouForYourPatience 

Remember to give me a kudo if you like my post! Accepting my post as a solution is even better! Also remember that search is your friend.

Can I queue events as long as Tealium is not loaded ?

Tealium Employee

Hi @PatrickHegnauer and @filip_lejon

Out of the box, utag doesn't have this functionality, unfortunately.

However, that being said if you are able to either:

  1. Modify the source of the page, where the utag snippet is
  2. Create a middleware layer between your calls to utag.view/link

Then a solution can be created. I would highly recommend adding to the Product Ideas board to have this baked into the product.

If you would like to learn more I can do a quick write up for you, on how you would go about this.

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.

Can I queue events as long as Tealium is not loaded ?

Gold Contributor
Gold Contributor

@adrian_browning Thanks for your insights, I would love to see a quick write up, on how to go with this.

Kind Regards

Patrick

Can I queue events as long as Tealium is not loaded ?

Tealium Employee

@PatrickHegnauer

Credit to one of our former colleagues Brian Kranson for this:

//Inline on the page
(
function(t,e,a,l,i,u,m){ if(t.utag)return;e=t.utag={};e.e=[]; e.view=function(a,b,c){e.e.push({a:a,b:b,c:c,d:"view"})}; e.link=function(a,b,c){e.e.push({a:a,b:b,c:c,d:"link"})}; e.track=function(a){e.e.push({a:a.data,b:(a.cfg?a.cfg.cb:null),c:(a.cfg?a.cfg.uids:undefined),d:a.event})}; }(window));

 

// Very first preloader code
// put the utag_events into the window scope as utag_events
// then delete utag so that the utag.js will build up as needed
(function(w){
    if(typeof w.utag !== 'undefined' && typeof w.utag.e === 'object'){
        w.utag_events = w.utag.e;
        delete w.utag;
    }
}(window))

 

// DOM Ready Extension
// loop through the window level array utag_events and call utag.track as necessary
// utag.track will use the view or link or any event as well as the callback or list of tag ids (function(w){ if((typeof w.utag_events === 'object' && w.utag_events.length > 0)){ while(w.utag_events.length){ d=w.utag_events.shift(); (function(d){ setTimeout(function(){ utag.track({ event: d.d, data: d.a, cfg: { cb: d.b, uids: d.c } }); }, 150); })(d); } } }(window))

 

Adrian

Ask me anything Tealium related or TypeScript/JavaScript, or NodeJS.
Please remember to mark solutions as accepted for future searchers.
Public