Synchronously load javascript files

Bronze Contributor
Bronze Contributor

Dear all,

I have a question in mind ! i have Tealium loaded Asynchronously in my website, and i ant to know how it can load synchronously my javascript files ? 

Meaning, Async files will load sync javascript files ? 

Anyone can explain that please ?

3 REPLIES 3

Synchronously load javascript files

Employee Emeritus

Hello @soufiane-fadil. Does this article help?

 

https://community.tealiumiq.com/t5/Tealium-iQ/Asynchronous-vs-Synchronous-async-vs-sync/ta-p/13490

 

I look forward to your reply. 

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.

Synchronously load javascript files

Employee Emeritus

Hello again, @soufiane-fadil. We do have articles that describe both scenarious of Optimizely implementation. Please find them below:

 

How you implement Optimizely is entirely based on your business needs. I would recommend that you work with your internal stakeholders to figure out if a synchronous or an asynchronous implementation is right for you.

 

Both of the documents will describe best practices as well. Please let me know if you have any further questions. Thank you. 

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.

Synchronously load javascript files

Tealium Employee

@soufiane-fadil, it is javascript 'standard' or rule that one can not load a 'synchronous' code inside an asynchronously loaded file.  This is not a Tealium requirement but part of the ECMA standard.

 

You typically have two options in Tealium to implement synchronous code,  use the utag.sync.js or adapt the code for use asynchronously.

 

To load synchronous code, tealium provides for the use of separate file loaded synchronously to your page code.  This file is the utag.sync.js file and is a separate independent file from the main utag.js file, typically loaded in the <head>. You have access to place code into this file through TIQ.  

 

  • You must first have the utag.sync.js coded on your page to load synchronously ( usually in the <head> ).
  • You can then place you synchronous code inside this file through TIQ and code inside should be considered independent from the built in functionality of the utag.js.

Conversely if you have 'synchronous' code you need to implement you can always check with the vendor if they have an asynchronous version.  You can also refactor the code snippet if it has "document.write's" to do the same thing but in asynchronous code.  

 

If your tag must be loaded synchronously ( like Optimizely ) and through Tealium then you will need to consider using the utag.sync.js option.  

 

 

Public