New

50% off Shop Products & 50% off 1st Month of Retainer Packages. Terms apply*. Contact us to apply your discount.

How to configure click identifiers in GA4

We're running a competition. Giving away a free SEO backlinks bundle to a lucky email subscriber in October.

*Terms and conditions apply.

Home » Articles » Web Analytics » How to configure click identifiers in GA4

You’re spending money on ads but deep down you’re not sure if any of them are actually doing their job. You check the numbers hoping for clarity but instead you’re left guessing.

This article explains how setting up click identifiers can finally give you clear answers. You’ll learn how to track the full journey from ad click to conversion so you know exactly what’s driving results.

What are click identifiers and why should you care?

Click identifiers are unique tracking parameters that get automatically added to your URLs when someone clicks on your ads. Each platform has its own version: GCLID (Google Click Identifier) for Google Ads, FBCLID (Facebook Click Identifier) for Meta/Facebook ads, TTCLID (TikTok Click Identifier) for TikTok ads, MSCLKID for Microsoft Ads, TWCLID for X (formerly Twitter) ads, and LI_FAT_ID for LinkedIn ads.

When a user clicks on your ads, whether from Google Ads, TikTok Ads, or X (formerly Twitter), a unique click identifier is often generated by the media platform and added as a query parameter to the landing page URL. For example, when someone clicks your Google ad, your URL might look like this: yourwebsite.com?gclid=abc123xyz.

The emotional reality is this: every time you lose a click identifier, you’re losing valuable attribution data. That conversion you thought came from organic search? It might have actually come from your expensive Google Ads campaign. That’s money down the drain and decisions based on incomplete data.

How to set up GCLID for Google Ads in GA4

Step 1: Enable auto-tagging in Google Ads

The first step feels almost too simple, but it’s crucial. You need to turn on auto-tagging in your Google Ads account.

To enable auto-tagging in Google Ads, follow these steps: Sign in to your Google Ads account. Click “Settings” on the left page menu. Click “Account settings” at the top of the page. Click the “Auto-tagging” section. Check the box next to “Tag the URL that people click through from my ad”. Click “Save”.

Once you enable this, you should see the gclid parameter in your landing page URLs when you test your ads. Don’t skip the testing part – it’s your safety net.

Your next move is connecting your Google Ads account to GA4. This creates a bridge between your ad spend and your analytics data.

In your GA4 account, go to Admin > Product Links > Google Ads Links. Click “Link” and follow the prompts to connect your Google Ads account. Now GA4 and Google Ads are best buds, and you’ll be able to track GCLID along with other Google Ads data.

Step 3: Configure GCLID tracking with Google Tag Manager

This is where things get technical, but don’t worry – I’ll walk you through it step by step.

First, create a URL variable in GTM: Go to Variables > New, select “URL Variable”, set the Query Key to “gclid”, and save the variable.

Next, set up your GA4 Configuration tag: In GTM, go to Tags > New, and select Google Analytics: GA4 Configuration. Enter your GA4 Measurement ID (you’ll find this in GA4 under Admin > Data Streams). In the “Fields to Set” section, add a new row. For Field Name, enter “custom_parameter.gclid” (or create a custom dimension). For Value, select your GCLID variable. Set the trigger to “All Pages”, save and publish.

Step 4: Create custom dimensions for GCLID

You can get Google Analytics 4 ready to collect GCLID data by following the steps below. In GA4, go to Admin > Custom Definitions > Custom Dimensions.

Click the Create Custom Dimensions button and then enter: The name of the parameter. You can enter whatever you want. Accordingly, GA4 will display the dimension in your reports. For example, you can name it “GCLID” or “Google Click ID”. Scope. Since we want to apply this parameter only to one event (and not to all events of the same user), we need to select Event. Event parameter. Here, you must enter the name precisely as you entered it in the GTM tag.

Step 5: Test your setup

Preview in GTM: In Google Tag Manager, click “Preview” and test your setup on your site. Make sure the GCLID parameter is getting captured when someone clicks an ad. Check GA4 DebugView: Over in GA4, go to DebugView and keep an eye on user sessions. You should see the GCLID parameter coming through along with the rest of your data.

How to handle other platform click identifiers

Managing FBCLID (Facebook Click Identifier)

Here’s where it gets tricky. FBCLID is Facebook’s Click Identifier – a query parameter appended to all links posted on Facebook since 2018. Unlike GCLID, FBCLID can actually hurt your GA4 reporting by creating duplicate URLs.

This dimension WILL include all query parameters appended to the URL, including FBCLID. When we look at the values of this dimension, much like we saw in Universal Analytics before, a fragmented list of URLs appears here in GA4 with a unique value for each time a user has clicked on a link via Facebook and ended up on your site.

To fix this, you need to strip FBCLID from your URLs using GTM: Install the “Trim Query” template from the GTM Gallery, create a new variable using this template, set it to remove “fbclid” from URLs, and update your GA4 configuration to use this cleaned URL.

The process involves stripping the FBCLID parameter (and any other unwanted parameters) from the URL, rewriting the ‘page_location’ field in our GA4 tag, and then sending the ‘page_view’ event to GA4.

Tracking TTCLID (TikTok Click Identifier)

TTCLIDs or TikTok Click IDs are tracking parameters appended to a landing page URL whenever a user clicks an ad on TikTok. They started gradually rolling out this auto attachment on 11/17/22.

Unlike FBCLID, TTCLID can be useful for attribution. Set it up similarly to GCLID: Create a URL variable for “ttclid”, add it to your GA4 configuration, and create a custom dimension for TikTok attribution.

Attribution updates for 2025

In 2025, Google will be changing this to a waterfall logic and adding a new tagging method in between: Auto tagging – Ad Identifiers. This remains the same, using gclid/dclid URL parameters.

Now here’s the issue. Due to privacy regulation, if users do not consent to advertising (eg. ad_user_data flag is denied), the gclid URL parameter (which is unique to a user) cannot be used by Google. That means, in cases like this, GA4 has no way of telling if the traffic source is Paid or Organic.

Best practices for 2025

The case-sensitivity rule

This cannot be stressed enough: Click identifier values are case-sensitive. Case-sensitivity means that values that differ solely by case are treated as differently as if they’d differ by actual values, too. In a case-sensitive context, abc123XYZ is not the same as abc123xyz.

When working with gclid, for example, Google’s documentation clearly states that the gclid query parameter value should not be normalized at any point of data capture. If you change it to all-lowercase or all-uppercase, the value will change and attribution will be broken.

Browser cookies are the standard in these scenarios, even though modern browsers are working to reduce their longevity. Storing the click identifier in a cookie ensures it persists as users navigate your site.

Make sure to set cookies on the root domain (example.com), use the root path (/), only set cookies when identifiers are present, and update cookies when new identifiers appear.

Backup storage solutions

While cookies are useful, they’re not foolproof. Tracking protections in browsers like Safari may shorten their lifespan or block them entirely. It’s helpful to have a backup like localStorage. Unlike sessionStorage, it persits even after a user closes their browser.

Common mistakes to avoid

Website stripping parameters

Sometimes, the problem isn’t in your tags and scripts in Google Tag Manager, but with how your website handles unfamiliar parameters in the page URLs. Even if you’ve correctly implemented click identifier value retrieval tracking in Google Tag Manager (or hardcoded it), your website might automatically strip out click identifiers from the URL unless they have been allowlisted first.

Test your landing pages by adding click identifiers manually and reloading the page. If they disappear, work with your engineering team to whitelist them.

Relying only on URL parameters

Grabbing the click identifier directly from the URL and auto-filling a hidden form field at the point of user form submission is a valid approach, but only in certain situations. This works well if the form is on the same landing page where the user first arrives after clicking the ad. But what if the user browses to other pages before submitting the form? In that case, the click identifier URL parameter is no longer available, and you lose the attribution.

Let’s say a user lands on a subdomain create.example.com, and your cookie is configured only to be set for that subdomain. If the form is on www.example.com, for example, the cookie won’t be available, and the identifier will be lost.

Conclusion

When you implement these tracking methods correctly, you’ll finally see which ads are truly driving results and which ones are just burning budget.

Start with GCLID if you’re running Google Ads, then expand to other platforms as needed. Test everything thoroughly, and don’t be afraid to iterate as you learn what works best for your specific situation.

The data you collect today will inform the marketing decisions you make tomorrow. Make sure that data tells the complete story.

We'll assist you in building a website that works through our exclusive newsletter

Kahunam values everyone who visits us. We have been secretly working behind the scenes to create useful resources like checklists, security guides, helpful tools and plugins, and exclusive deals and freebies to help visitors. All of this becomes yours when you subscribe (because the best stuff should go to the people who stick around).

Book a Discovery Call