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
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
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:
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.
In EventStream, add an event attribute of type string, named “ga_cid”.
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.
The next step is to create the Google Analytics connector.
In AudienceStream, go to Connectors and add the Google Analytics Connector.
Enter the Google Tracking ID from your Google Analytics Admin page.
Add a Send Analytics Event Data action.
Set Source audience used to segment the users.
Map the visitor attribute “ga_cid” to Client ID.
Map a custom value of "1" to "Non-interactive".
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.
You will need to provide a value for the Event Category and Event Action. These could again be something like “Joined Audience XYZ”
Set "When" to "Joined Audience"
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.
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:
If Display Advertising is working correctly (and you've left it at least one minute before trying again), the response is 302 redirected to
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
This then may get a 302 redirect to
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.
... View more
Question Why aren't my cookies being set?
Answer By default, utag.js will set cookies in the domain it is being loaded on. However, f or security reasons, browsers do not allow cookies to be set on top-level domains (TLD), such as ".com", ".org" or ".co.uk". What you may not realize is that there are hundreds of actual domains that are also considered to be TLD , on which cookies are also restricted.
Some common domains affected include:
In these cases where cookies cannot be set, you can override the cookie domain in the Publish Configuration settings. Please note that this is a global setting and applies to all environments you publish to.
To learn more about which domains are considered TLDs, please visit https://publicsuffix.org/list/.
... View more
If you’re firing a utag.link(), Google requires the eventAction, eventLabel, and eventCategory variables to be defined and populated as Google views this as an event. If you use utag.view() instead, you do not need all three of these categories.
Thank you, Shelli White
... View more
The Source may not display if AudienceStream is not activated. Could I have you please contact your Account Manager to discuss activating AudienceStream?
... View more