- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog Blog
- Support Desk Support Desk
This post outlines the steps to load Optimizely Synchronous via the utag.sync.js container. The utag.sync.js runs early in the page load when it is included in the <head></head> section of the page's HTML. To current users of the Optimizely Sync Tag: we highly recommend switching to this form of implementation as the Tag has been deprecated. Only existing Tag instances are supported.
NOTE: Tealium's best practice is to load all tags Asynchronously. See this POST on how to implement Optimizely Asynchronous. For an understanding of the trade-offs between Asynchronous and Synchronous loading of testing tools see this POST.
IMPORTANT: Optimizely Tool is unable to detect utag.sync.js
At the time of writing, Optimizely's tool is NOT able to detect their Synchronous script when served via a Tag Management System. Running the tool on a page where Tealium iQ is serving the script causes it to display an error message (screenshot below). Optimizely is working quickly to resolve this issue, until which point it is safe to ignore the error message. Our recommendation would be to use the Ghostery tool to verify whether or not Optimizely Synchronous is loading on the page as expected.
This method assumes the utag.js file is coded Asynchronously on the page.
STEP 1: Enable utag.sync.js file creation
STEP 2: Add the utag.sync.js script to all pages where tests will be performed. Here's how to access the script:
STEP 3: Configure Optimizely Project number
document.write('<script type="text/javascript" src="//cdn.optimizely.com/js/12345678.js"></scr'+'ipt>');
STEP 4: Save/Publish your profile.
Now, on the page, the utag.sync.js file will load at the very top because it is inserted in the <head></head> of the HTML. This will synchronously load the Optimizely JavaScript file very early in the page load and the A/B tests will be initiated very early as well. Then, later in the page load process, the utag.js file will load and the rest of your Tags will load asynchronously.
Copyright All Rights Reserved © 2008-2022