How To: Collect GCLID from Google Ads in GA4 via GTM | GlowMetrics

May 30th 2024

Digital Analytics Insights

4 min read

Posted by Michael Wilson

How To: Collect GCLID from Google Ads in GA4 via GTM

If you’ve been wondering how to store the GCLID parameter from your user’s Google Ads clicks in GA4, this is the guide for you.

GlowMetrics Social Link GlowMetrics Social Link GlowMetrics Social Link GlowMetrics Social Link GlowMetrics Social Link

If you’ve been wondering how to store the GCLID parameter from your user’s Google Ads clicks in GA4, this is the guide for you.  If you’ve found your way here and you’re wondering why you would want to do that, let’s explain.

 

What is GCLID?

GCLID is Google’s Click Identifier – a key element for successfully tracking your Google Ads performance.  It tie’s a user’s ad click which brings them to your website back to the original ad they clicked on, allowing you to piece together which campaigns, keywords, ad sets etc are successfully driving sales or conversions on your website.

 

Why store GCLID in GA4?

The core function of the GCLID parameter is to measure the success of your Google Ads campaigns, primarily for Google Ads reporting within its own interface.  GA4 typically identifies Google Ads traffic successfully within its attribution reports without over-engineering a solution (like we’re about to!)

That being said, there may be times where you have a particularly long lag between a user clicking on your ad and deciding to make a purchase or signing up for your services – probably not an issue if you’re selling socks but might be an issue if you’re selling houses, cars or some other high value item that people may spend significant time researching before they commit.

GA4 does have its own Attribution Path reports which will show you how various channels have worked together if a user has visited your site multiple times from multiple different sources prior to converting but if your main interested is showing the value of your Google Ads campaigns, you may want to collect the GCLID parameter in GA4 as a User Scoped Custom Dimension.  This means that once that user has been associated with a GCLID, you will know they’ve come in from a Google Ad at some point and any future conversion can be tied back to Google Ads, even if they have come back via another channel since then.

 

How to store GCLID in GA4 via Google Tag Manager

As long as you have auto-tagged enabled in Google Ads, the GCLID parameter will be appended to the URL when the user clicks on your ad and lands on your website.  The value with any URL parameter can be captured using Google Tag Manager and sent to any data collection end point – in this case, we want to collect the GCLID parameter and send it to GA4.

1. In GTM, create a new variable – Variable Type = URL, Component Type = Query, Query Key = gclid

 

2. We then need to set up a tag to send that new variable to GA4 as a User Property.  The easiest way to do this is by using a dedicated event specifically for this purpose but you could also send it along with a pageview if you prefer – that might be a little neater.  As a simple example, we’re creating a new event here called ‘gclid_pickup’.

 

3. The trigger for this tag should be… Page URL contains ‘gclid’ so it only fires if there is a gclid parameter in the URL.

 

4. The final step is to create a new User Scoped Custom Dimension within the GA4 interface itself.  If you skip this step, you won’t see this data in GA4 anywhere – you need to do this to actually expose it in the reports.

This should allow you to see the value of the GCLID parameter within your GA4 reports – if a user has come in from clicking on a Google Ad.  One small caveat here, if the user comes in from clicking on multiple ads, the value of the GCLID associated with that user will always be from the most recent ad click.  This shouldn’t be a problem if your primary aim here is to show the value of your Google Ads campaigns for products/services with long lead times but something to note nonetheless.

 

Want to Learn More About Google Tag Manager?

For more on Google Tag Manager, check out our blog on FBCLID (Facebook’s Click Identifier) and how it impacts GA4 data or How to Add a Google Ads Conversion Linker tag. If you have any questions or there’s anything else we can help with on Google Tag Manager, please leave a comment below, or email contact@glowmetrics.com.

You can also stay up-to-date by following GlowMetrics on Twitter or LinkedIn or by subscribing to our newsletter (link below) for the latest tips and news in the world of digital analytics and marketing.

Don’t forget to sign up for a FREE account on our Resource Hub to access a wealth of valuable resources, including exclusive Google Tag Manager how-to videos and insights!


GlowMetrics Social Link GlowMetrics Social Link GlowMetrics Social Link GlowMetrics Social Link GlowMetrics Social Link

Leave a Reply

Your email address will not be published. Required fields are marked *

GlowMetrics

Posted by
Michael Wilson

Michael is the Digital Analytics Director at GlowMetrics, implementing complex tracking for our largest clients via Google Tag Manager while leading our wider analytics work across Google Analytics, Data Studio and Optimize
Read more from Michael Wilson

Browse by Category



GlowMetrics
Optimise your website and marketing campaign performance with Ireland’s leading digital analytics agency
Sign up to our newsletter