Step-by-Step: Linking Your Google Analytics and Optimize Accounts and Installing the Optimize Snippet

To begin using Optimize, you must first setup your account and container (see this post with a Step-by-Step of how to do that), and then link your Google Analytics property to your Optimize account. In this post, I’ll show you how to setup your linking.

Step 1: After logging into, and after having setup your account and container, you should see something like the below container, ready for you to create your first experiment. Before we do that, however, I’d recommend linking your Google Analytics property first (note: you can do this in any order, but to launch an experiment you must have a linked GA property, and the Optimize snippet on your page, so I like to do these steps first). On the right hand nav bard, on step number 2, click the blue button that says “Link Property”

Step 2: Next, you’ll choose which property and view you want to link from a list of Google Analytics Accounts and properties you have access to with the Google Account you are using to access Optimize. Note that you must have both Optimize and Google Analytics permissions for the associated email. If you do not have access to the Google Analytics account you want to link, talk to your admin to get the right email address added.

In this case, I’ve chosen to link to the PROD view of my blog property. I use “TEST” to test out new filters and view setting changes, rather than send my Optimize Test data there. You can see this post on more information for best practices of View setup and use.

Step 3: Once you link your accounts, Optimize will popup a notice asking you to place the Optimize snippet on your website. This is step number 3 on the right hand nav bar. Again, you can skip this for now and setup your experiment(s), however, you won’t be able to launch an experiment until this step is done, so let’s go ahead and hit “Get Snippet” and set this up.

Step 3.5: Clicking “Get Snippet” will pop up another box with the snippet you’ll need to implement. You can do this in a couple different ways: hardcoding on the page or via Google Tag Manager. Note that Optimize requires Universal Analytics (analytics.js), if you’re still running Classic (ga.js) you’ll need to upgrade before you can use Google Optimize.


Because I have GTM already setup on my blog and I consider it easier to launch it this way, I’m going to go that route. As you can see from the above screenshot, however, it’s quite easy to modify your existing analytics.js snippet if you do use a hardcoded version to just include one additional line (in bolded text in the screenshot).

In this case, I’ve created a new tag with Tag Type ‘Google Optimize’. I’ve named it clearly as ‘Optimize Tag’ and I’ve selected my constant string variables for gaProperty and Optimize containerID (the latter I created as I made this tag to ensure that this would be held constant in any additional tags). It’s important to note that the tag settings need to be the same between your Optimize tag and your GA Pageview tag, so be sure to use the same constant string variable for gaProperty and that your ‘More Settings’ are also aligned. Finally, I’ve added a trigger for ‘All Pages’ because I want this tag to apply everywhere so that I can test on all pages of my website.

Once I’m done creating the tag, I’ll save it, preview and debug the 2 changes I made (adding an Optimize tag and a constant string variable for my Optimize container ID).

I’ve confirmed the new Optimize tag is firing as intended, so I’ll go ahead and publish. Now my Optimize snippet is configured using GTM!


Posted by Krista Seiden in her own words, not on behalf of her employer

Leave a Reply

Next ArticleStep by Step: Using GTM Workspaces