Google Optimize

Deploy the Google Optimize tag with Tag Manager.

Optimize allows you to test variants of web pages and see how they perform against an objective that you specify. It monitors the performance of your experiment, and tells you which variant is best. Optimize can be deployed from Tag Manager.


The Optimize tag may be deployed from any existing Tag Manager web container. However, for the best results we recommend implementing the JavaScript portion of your Tag Manager container snippet as high in the <head> of the page as possible, following the latest installation guidance.

We also recommend installing the Optimize page-hiding snippet on pages where you deploy Optimize.

Developers should ensure that dataLayer declarations appear before the Optimize page-hiding snippet and Tag Manager container snippet. Learn more.

Tag setup

  1. Click Tags → New.
  2. Change the default name of "Untitled Tag" to a descriptive title, such as "Optimize -"
  3. Click Tag Configuration → Google Optimize.
  4. Enter your Google Analytics Tracking ID and your Optimize container ID (a.k.a. the Optimize snippet ID, available the Optimize Container setup panel.)
  5. Click More settings, and configure the Fields to Set and Advanced Configuration with the same values as your Google Analytics tags.
  6. Click Save, and proceed to save the tag without triggers.
  7. Open any Google Analytics Page View tags that are being triggered on load of pages where you want the Google Optimize tag to be fired. Note: Universal Analytics (analytics.js) or Global Site Tag (gtag.js) are required to use Optimize. Classic Google Analytics (ga.js) isn't supported.
  8. Click to edit the Tag Configuration, and open Advanced Settings → Tag Sequencing.
  9. Check the box to fire a tag before this tag fires, and select your Google Optimize tag as a “Setup Tag”.
  10. Click to Save your Google Analytics Page View tag, and repeat on any other Google Analytics Page View tags as relevant.
Important: Since Google Optimize works in tandem with Google Analytics, the tracker settings of your Optimize tags (found under More settings) must be consistent with those of your Google Analytics tags. Using constant variables can help with consistency between tags by providing a single place to change a commonly-used value, such as your Analytics Tracking ID.
Was this article helpful?
How can we improve it?