resources

Optmyzr Blog

How to Add GCLID Data to Google Analytics

Frederick Vallaeys

Co-Founder & CEO

-

Optmyzr


Adding Google’s Click ID (GCLID) to Google Analytics is a powerful way to better understand the behavior of people who come to your site after clicking on one of your ads. But to see GCLID data in Google Analytics requires a few steps. We’ll walk you through these in this article.

1. Create a new custom dimension in Google Analytics

Here are the steps to help get the first part of GCLID tracking set up in Google Analytics:

  1. Go to the Admin section of your Google Analytics profile by clicking the settings wheel at the bottom left.
  2. Click Custom Definitions and the Custom Dimensions in the middle column.
  3. Click the button to create a new Custom Dimension.
  4. Name the new custom dimension ‘gclid’.
  5. For scope, select “User”.
  6. Save your changes.
  7. Look at the table with all your custom dimensions and write down the index number for the one you just created. We’ll need this shortly for another step.

2. Use Google Tag Manager (GTM) to capture the GCLID from the URL

The GCLID is passed in the URL by Google when a user clicks on your ad. Google Analytics doesn’t natively know what to do with this so we need to tell it that the GCLID’s value should be stored in the custom dimension we just created.

There are many ways to do this, but one of the most easily repeatable ways is by using Google Tag Manager. Here we’ll tell it to grab the GCLID from the URL.

  1. Open your GTM container.
  2. In the Variables section, add a new User-Defined variable.
  3. For Variable Type, select ‘URL’.
  4. For Component Type, select ‘Query’.
  5. For Query Key, type in ‘gclid’.
  6. Leave all other settings as they are and save the variable.

3. Use Google Tag Manager to send the GCLID to Google Analytics

Now that GTM knows how to grab the GCLID from the URL, we need to send that value to Google Analytics. GTM can do this for us as well.

This is where everything comes together so the steps refer back to the things you did in the previous two instruction lists. We’ve included ample screenshots to make it as easy as possible to follow along.

  1. If you already use GTM to put Google Analytics on your website, go to your existing tag. Otherwise, create a new tag for Universal Analytics.
  2. In the tag configuration, open the dropdown for Google Analytics Settings and create a New Variable.
  3. Add a Custom Dimension under ‘More Settings’.
  4. For the index field, enter the number you wrote down from step 7 in the first instruction list on this page (create a new custom dimension in Google Analytics).
  5. For Dimension Value, click on the brick icon to open your available list of variables.
  6. Select the variable you created in the previous set of steps (use Google Tag Manager to capture the GCLID from the URL).
  7. Save the tag, test your GTM changes and publish them.

4. Use Google Analytics to see GCLID data

Note that the GCLID custom dimensions data will not be retroactively added into your old Google Analytics reports so you’ll have to wait a few hours for new data that does include the GCLID to appear.

As an example of a report you can now run, go to a report like ‘Behavior > Site Content > All Pages’ and in the Secondary Dimensions dropdown select ‘gclid’.

Your report will now include both the URL and the gclid.

You can download this data and using lookups in spreadsheets, start to build a more holistic view into the behavior resulting from clicks on your Google Ads.

When you add GCLID as a custom dimension in Google Analytics, Optmyzr will help you explore, build, and optimize audiences, as well as help with offline conversion import (OCI).