How to Pass a Google Analytics Custom Dimension through AudienceStream for RLSA AdWords

How to Pass a Google Analytics Custom Dimension through AudienceStream for RLSA AdWords

by on ‎11-09-2018 06:59 AM - edited 3 weeks ago by Community Manager (306 Views)

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

In this article:

Table of Contents Placeholder

Prerequisities

  • Google Analytics account (linked to AdWords)
    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 Collect tag.

  1. In EventStream, add an event attribute of type string, named “ga_cid”.
  2. Add a visitor attribute of type string also named “ga_cid” and set this to the event attribute ga_cid when that event data attribute is assigned.
    ga_cid.png

The next step is to create the Google Analytics connector.

  1. In AudienceStream, go to Connectors and add the Google Analytics Connector.
  2. Enter the Google Tracking ID from your Google Analytics Admin page.
  3. Add a Send Analytics Event Data action.
  4. Set Source audience used to segment the users.
  5. Map the visitor attribute “ga_cid” to Client ID.
  6. Map a custom value of "1" to "Non-interactive".
  7. Map a value to the custom dimension number you’re going to use in Google Analytics. 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”
  9. Set "When" to "Joined Audience"mapping.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 “When” 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 Adwords
  • 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.