Google Analytics (GA) can be linked to Google Ads. A GA custom dimension can be used as the basis of a GA audience. Therefore, with GA linked to Ads, this approach can be used to add or remove visitors from remarketing lists for search ads segments (RLSA) in Ads.

In this article:

Table of Contents Placeholder

Prerequisities

  • Google Analytics account (linked to Ads)
    The non-premium version is acceptable, but will be limited to 10M hits per month. This includes both the hits from the page and the AudienceStream connector firing.
  • Google Analytics tag (gtag.js version)
    The tag must be present on the page to fire at least once per session with the following settings:
    • Custom Dimension (scoped to User level)
    • Display Advertising Feature enabled (see screenshot below)  You can check this is working properly on a site using the instructions in the Appendix at the bottom of this article
      gtag.png
  • Tealium Collect tag
  • AudienceStream account with a target audience

Capture Google Client ID

Add a Set Data Value extension scoped to the Tealium Collect tag to set the variable ga_cid to the GA first-party visitor cookie with the leading part removed. This allows AudienceStream to identify the same user as the tag.

The code snippet is:

ga.getAll()[0].get('clientId')

ga.png

Using the Google Client ID in EventStream and AudienceStream

The first step is to create the event and visitor attributes to capture the client ID coming in from the Tealium Collect tag.

  1. In EventStream, add an Event attribute of type String named ga_cid.
  2. Add a Visitor-scoped AudienceStream attribute of type String named Google Client ID and set this to the Event attribute ga_cid when that Event attribute is assigned:
    ga_cid.png

Next, create the Google Analytics connector.

  1. In AudienceStream, add the Google Analytics Connector and enter the Google Tracking ID from your Google Analytics Admin page.
  2. Set Audience to the AudienceStream audience used to segment the users.
  3. Set Trigger to "Joined Audience"
  4. Add a Send Analytics Event Data action.
  5. Map the Visitor-scoped AudienceStream attribute Google Client ID to Client ID.
  6. Map a custom value of "1" to "Non-interactive".
  7. Map a value to the custom dimension number you created in Google Analytics during the Prerequisities portion of this guide. You could make this be a fixed string, for example “In Audience XYZ.” In the screenshot below, we are setting custom dimension 1 in GA to the value “In Audience XYZ” when the user enters our audience in AudienceStream.
  8. You will need to provide a value for the Event Category and Event Action. These could again be something like “Joined Audience XYZ”
    GA1.pngGA2.png

Depending on the nature of your use case, you may be able to reuse the same custom dimension for multiple audiences, as long as the audiences are mutually exclusive (for example, a progression). If they are, then you can duplicate step 3 above for each audience involved. If they are not, then you probably want the GA custom dimension to be set to a different value when the visitor leaves the audience. In this case, duplicate step 3, but set the Trigger to “Left Audience”

Creating a Google Analytics Audience Based on the Custom Dimension

You do this under in the Admin section of Google Analytics under “Audience Defintions, Audiences” 

  • The “View” can be “All Web Site Data”
  • The “Destination Account” should be the same Account ID you see as your Customer ID in Google Ads
  • You should define the Audience to be when the custom dimension has the value you are passing to it from AudienceStream.image2.png

Verifying the Display Advertising Feature

This can be done using Charles Proxy or a similar tool.  You need to be able to see the cookies that are set and sent (Chrome Dev tools no longer shows you this in all cases).  The chain of redirects below is an example. Your exact behavior might be different, but the important thing is that redirects are happening.

  • Visit the page. Allow one minute before refreshing the page to see this synchronisation happen again.
  • The GA request looks like this:
https://www.google-analytics.com/r/collect?v=1&_v=j72&a...%26displayadfeatures%3Dtrue&...&cid=2128420176.1544479572&tid=UA-63675582-1&_gid=384905662.1544479572&_…
  • If Display Advertising is working correctly (and you've left it at least one minute before trying again), the response is 302 redirected to 
https://stats.g.doubleclick.net/r/collect?v=..&tid=UA-63675582-1&cid=2128420176.1544479572&.
  • The request will send the DoubleClick IDE cookie from the user's browser, if it is already present, but the response from this request does not set one if it wasn't already present. This in turn gets a 302 redirect to 
https://www.google.com/ads/ga-audiences?...tid=UA-63675582-1&cid=2128420176.1544479572.. 
  • This then may get a 302 redirect to
https://www.google.co.uk/ads/ga-audiences?...tid=UA-63675582-1&cid=2128420176.1544479572
  • This last request gets a 200 response. It will disclose the NID cookie previously set by a visit to the Google Search site. Again, it will not try to set one if it doesn't already exist.
Version history
Revision #:
17 of 17
Last update:
3 weeks ago
Updated by: