- TLC Home Home
- Discussions Discussions
- Documentation Documentation
- Knowledge Base Knowledge Base
- Education Education
- Blog Blog
- Support Desk Support Desk
Tealium's best practice is to load all tags Asynchronously. This post will outline how to follow the Tealium best practices when implementing Optimizely. For an understanding of the trade-offs between Asynchronous and Synchronous loading of testing tools see this POST. For options to implement Optimizely synchronously see this POST.
There are two methods of implementing Optimizely Asynchronous. The content of your site and your testing requirements will determine which approach to use. It is recommended that you try the two methods in the order they appear in this post.
NOTE: Both methods assume the utag.js file is coded asynchronously on the page.
This method is recommended because the tag will not block anything else from loading in the page.
This Tag is available in Tealium's Tag Marketplace, which is home to a large selection of vendor Tags. Click here to learn how to add a Tag to your Tealium iQ profile.
Here are the steps to set it up:
Destination Name | Destination Variable | Description | E-Commerce Extension Mapping (RECOMMENDED) |
---|---|---|---|
Project ID | projectId | Project identifier provided by Optimizely | N/A |
Order ID | orderId | Unique identifier assigned to the order | "_corder" variable maps to this destination |
Revenue in Cents | revenue | Subtotal amount (in cents) of the order | "_csubtotal" variable maps to this destination |
Event Name | eventName | Name/Type of conversion event Default event is "purchase" |
N/A |
IMPORTANT: For the Async Tag to fire as soon as possible, make sure the utag.js file is coded as high in the page as possible. Tealium recommends placing the utag.js at the top of the HTML <body> tag. Tealium will load the Optimizely JavaScript file and take care of the rest.
Optimizely typically prefers to be synchronous on the page so it can run "sooner" and determine the test before other stuff (like your Analytics tool) runs. However, the only way to have Optimizely run soon enough and still be asynchronous is by serving its .js library from an alternate location. In doing so, the Optimizely Async Tag becomes a blocking Tag and any subsequent asynchronous scripts (e.g. utag.10.js) will not load until the blocking Tag is complete.
NOTE: Make sure to upgrade the utag.js version if you are not already using the latest (see utag.js Release Notes).
That's it! A few simple differences, but this will dramatically change the way the Optimizely file is loaded and how other tags are loaded after Optimizely.
Copyright All Rights Reserved © 2008-2023