#GTMTips: Google Ads Remarketing In GTM Server Containers
Google has released the Google Ads Remarketing tag for server-side tagging in Google Tag Manager.
Functionally, it’s remarkably similar to the Conversion Tracking tag they released previously. In fact, you should go ahead and read that article first, so that you have an understanding of how Google Ads tracking works through Server containers!
Follow this link to read the official documentation.
In this article, I’ll walk you through how to set things up, and I’ll also provide an overview of how it works.
XThe Simmer Newsletter
Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava into your email inbox!
Tip 127: Server-side Google Ads Remarketing
Similar to the Google Ads Conversion Tracking server-side tag, it’s not actually 100% server-side. Instead, it’s a hybrid.
Let me explain.
-
A Google Analytics 4 data stream, such as one generated by GA4 tags in a web container, sends data to the Server container.
-
The Server container intercepts this data with the GA4 Client.
-
A virtual container is then run, where the Google Ads Remarketing tag fires with the data pulled from the Google Analytics 4 data stream.
-
The Google Ads Remarketing tag initiates a signal back to the browser, with details about the request to the vendor servers the browser needs to perform.
-
The browser sends the request to the Google servers.
So why the roundtrip back to the browser? Why does the browser need to do all the work, when it should be a server-side setup?
The answer: third-party cookies.
For remarketing to work, the user’s browser needs to ping doubleclick.net
, as that’s where all the juicy cookies are that Google needs to build your cross-site profile.
If you observe the network logs of your browser, you can see the request to Google servers shortly after the event has been sent to the Server container:
So this is an important caveat to consider when working with Google Ads Remarketing. The user’s browser must support third-party cookies, and the doubleclick.net
domain(s) need to be allow-listed in the Content Security Policy of the site (if one exists).
How to set it up
To set up Google Ads Remarketing, you need three things in place:
First, you need an incoming Google Analytics 4 data stream from the browser, configured with the Send to server container setting instead of the legacy transport_url
field.
Second, you need a Conversion Linker tag running in the Server container. Set it to fire on the All Pages trigger. This is necessary to persist ad click information from the landing page to your conversion pages.
Third, you need a Google Ads Remarketing tag running in the Server container. We’ll get to its configuration in the next chapter.
Configure the Google Ads Remarketing tag
Essentially, you configure it exactly as you would configure a regular, web-based remarketing tag.
Conversion ID and Conversion Label (optional) can be retrieved from your Google Ads account following these instructions.
If you check Send dynamic remarketing event data, the tag will by default pull in the event_name
and value
parameters from the GA4 data stream. If you want to customize how these are retrieved, you can set Custom configuration as the Data Source instead.
If you want to comply with the California Consumer Privacy Act, you can enable Restricted data processing.
If you want to Provide custom parameters, you can check the respective box and then choose the Data Source. If you use the default data source of Event Data, then any event parameters sent with the GA4 request will be added as custom parameters to the remarketing ping. Again, you can also configure the key-value pairs with a custom configuration, like so:
Finally, if you check Provide User ID, then by default the tag will try to pull it from the user_id
parameter generated from the GA4 data stream. Again, you can pass the User ID with custom variables if you don’t want to use what’s in user_id
.
When you’re done configuring the tag, set it to fire with whatever trigger is necessary to build your remarketing audiences. Typically this would be the All Pages trigger, but you can of course use conversion events as well, such as add_to_cart
or begin_checkout
.
Interaction with Consent Mode
When working with Consent Mode, the process again resembles that of the Conversion Tag.
If ad_storage
is denied, then the Remarketing tag does nothing, as its only function is to run the doubleclick.net
request and thus access cookies in a third-party context.
When ad_storage
is updated to granted, then the GA4 data stream automatically re-sends the page_view
hit to the Server container, and any other event that has been flagged as a conversion in the GA4 UI.
If any of these events were configured to trigger the server-side Remarketing Tag, the end result is that the Remarketing Tag automatically fires again, it sends the signal to the browser, and then the browser sends the request to doubleclick.net
.
All of this is automated. You do not have to manually trigger your Google Analytics 4 tags again to make the Remarketing Tag work after consent has been granted.
Summary
As I lamented in my Conversion Tracking tag article, it’s a shame we still have these technologies built that rely on third-party cookies.
However, this is remarketing, a technology that relies on cross-site tracking across Google’s vast network of publishers and media sites willing to show your ads. The alternatives would be browser fingerprinting or things like email hashes, so perhaps third-party cookies are the best option, considering how much agency users have to block them.
The roundtrip back to the browser is also an interesting introduction to the “server-side” tagging stack, considering it makes the process less server-side and more a hybrid between the server and the client. I’m not entirely sure how I feel about this yet, but it does raise some feature ideas for client-side monitoring of server-side resources, for example, which might be a welcome change in the name of transparency.
In any case, this is how Google Ads Remarketing works with a Server container. Please let me know in the comments if you have questions or additional feedback!