Optimizely Snippet tag
Optimizely Snippet tag lets you run A/B tests on your website. In this article. we’ll explain how to set it up.
First of all, we need our Optimizely Project ID. The quickest way to get it is pulling it straight out of the URL of our project page:
Just copy this number, you’ll need it in the next step.
Set up a tag
Now go to your Tag Manager, and create a new synchronous tag:
Note: The A/B tags should always be served synchronously. This way the tested page content is displayed immediately after the page load, preventing a visitor from viewing the original content – avoiding Flash Of Original Content (FOOC). If the tag would be served asynchronously then the old version of the page would load first and would be visible for a second or so until the asynchronous tag would kick in, breaking the user experience.
Next, be sure to set up the trigger for your new tag. You may use the standard
All page views trigger to make sure the optimizely tag will be fired always. Or feel free to limit it with any of the available settings.
You may, for example, decide to run the tests only on particular dates or times of the day. You can of course also choose the tag to fire only on particular page URL etc.
To learn more about the triggers and the possibilities they offer to visit this article.
That’s it! You’ve integrated your website with optimizely! You may want to visit your website with the
?_stg_debug parameter to see if the tag fires properly if you have any doubts.
Feel free to read more about A/B testing from our blog: