Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideProduct feedbackGitHubNuGetDev CommunitySubmit a ticketLog In

Integrate Google Ads

How to integrate Google Ads with Optimizely Web Experimentation, create Optimizely Audiences based on ad campaigns and ad groups from Google Ads, target experiments based on your Google Ads referral data, and create personalized landing pages for your ads.

Optimizely integrates with Google Ads to connect your customer acquisition funnel to your conversion rate optimization. Use it to create symmetric messaging between your Google Ads creative content and your landing page, test the experience, and optimize for your paid traffic.

This integration lets you define Optimizely Audiences based on your Google Ads referral data and deliver consistent experiences to customers from start to finish. Optimizely Web Experimentation currently supports integrating with a single Google Ads account. Optimizely integrations are at the project level, so if you want to use multiple Google Ads accounts with Optimizely, you can create a project and set up the Ads integration with the other accounts.

Enable Ads in Optimizely Web Experimentation

  1. Click the toggle to turn on the integration and click Accept.

  2. Click Sign In with Google to connect your account.

  3. Select your Google account and click Continue.

  4. Select the checkbox next to See, edit, create, and delete your Google Ads accounts and data and click Continue.



If your Google Ads account does not contain any campaigns, the integration fails, and a Internal Server Error displays. Create at least one campaign in your Google Ads account before enabling the integration.

  1. Select the Ads account for Optimizely from a drop-down list if you signed in with an Ads Manager Account and manage multiple accounts.

Learn more about enabling the integration.

Add the Optimizely tracking template

Add the Optimizely tracking template text snippet to your Google Ads tracking template. If you use your Google Ads integration to target multiple experiments or campaigns, add the tracking template text snippet to your Google Ads campaigns, ad groups, or ads.

The Optimizely tracking template text snippet:


A few things to know:

  • opti_ca, opti_ag, and opti_ad are required and must have values. If opti_key exists, the snippet looks for the string and adds the digits to opti_ag to create a keyword. For example, if opti_key is kwd-5678 and opti_ag is 1234, then the resulting keyword is 1234:5678.
  • Lower-level tracking templates have priority over higher-level tracking templates. For example, if a tracking template exists for an individual ad creative, it overrides the tracking template of its higher-level ad group.
  • The tracking template text snippet does not affect your ads unless you already use the tracking template fields (opti_key, opti_ca, opti_ag, and opti_ad) in your tracking templates. If your tracking template matches the entire referral URL, it may affect your page analytics.
  • If you use tracking templates for redirects (with {lpurl1}, {lpurl2}, and so on), you may have conflicts with your existing tracking templates if you use multiple Google Ads management services. Ensure that the final URL that directs to your landing page includes the Optimizely tracking template text snippet.



These are instructions for adding the Optimizely tracking template in the Google Ads interface. If you use a third-party service to manage your ad campaigns, insert the text snippet at the end of your tracking templates through that provider.

  1. Log in to Google Ads and select Campaigns

  2. Add the Tracking template column and select Ad Groups. Click Columns and select Modify columns.

  3. Add the Tracking Template column under Attributes. Repeat this step for all ads and campaigns.
    For campaigns, the Tracking Template column is under the Settings tab in Google Ads, not the Campaigns tab. Modifying the tracking template of campaigns or ad groups does not trigger a re-approval process, but modifying the tracking template of ad creatives does.

  4. Identify the lowest level where you already have tracking templates.
    The hierarchy of levels in Google Ads is:

    • Campaigns (highest level)
    • Ad groups
    • Ad creatives (lowest level)
      Select the tab for that level to see if you have tracking templates implemented on a certain level. Then, click the Tracking Template column. If the column reorders to show existing templates, you already have tracking templates.
  5. Open the tab of the lowest level where tracking is implemented.

  6. Click the Tracking template column to reorder the rows. Select rows that include a tracking template. Click Edit and select Change URL options.

  7. Select Append text for the Action.

  8. Paste the following tracking template text snippet into the Append text field:

  9. Click Make changes to confirm.

  10. Select rows that do not have a tracking template.

  11. Click Edit, then Change URL options.

  12. Paste the following text snippet into the field next to Set value

  1. Click Make changes.

Create an audience using Ads

After you turn on the integration, you can create audiences in Optimizely that target your Google Ads campaigns. You can also add conditions to an existing audience.

  1. Go to the Audiences dashboard. Select an existing audience or click Create new audience. A Google Ads drop-down list displays.
  2. Drag and drop Ad Campaigns and Ad Groups to create audiences in Optimizely.



Removed and disabled campaigns and ad groups do not appear in the dropdown menu.

Test your integration

Use Optimizely’s Preview Mode as you build an experiment to check that your variation looks how you expect. Before you launch the experiment to visitors, verify that your tracking template is working by searching the URL for the terms used in the text snippet: opti_key, opti_ca, opti_ag, or opti_ad.

When you are ready to test your audience targeting in a live environment without showing it to visitors, use the test cookie method to verify that your Ads audience conditions let the right visitors in.

When you set the test and tracking template live for visitors, perform one final check by clicking the ad. It should let you be bucketed into the right variation. 

Your changes go live when the following conditions are met:

  • Your targeted Ads campaigns or ad groups are enabled and approved by Google.
  • You have inserted the tracking template text snippet into the required tracking templates.
  • Your Optimizely campaign is live.

Troubleshoot issues

Why do I not see some of my campaigns, ad groups, or keywords on the Create new audience page?

Optimizely does not show disabled campaigns (and their corresponding ad groups) or disabled ad groups (and their corresponding keywords).

You can see only paused or enabled ad groups from paused or enabled campaigns or keywords from eligible ad groups.

I have set up the integration with Google Ads, but I am not getting bucketed into the test.

Confirm that you have the opti_ca, opti_ag, and opti_ad parameters in the snippet, as mentioned in Test your integration.

The snippet adds data for the campaign/ad group if opti_ca, opti_ag, and opti_ad exist and for keywords if these parameters plus the additional opti_key exist.

Your tracking URL should look like this: &opti_ca=17953774510&opti_ag=0&opti_ad=0.