Google Click ID (GCLID) is the lifeline of ad attribution. When it breaks, revenue tracking vanishes. This brief explores the mechanics of parameter loss, diagnosis, and server-side remediation.
The Google Click ID is a unique alphanumeric string appended to your landing page URL. It bridges the gap between the Ad Click and the Conversion Event.
Used for auto-tagging. Decoded by GA4 and Google Ads to attribute Campaign, Ad Group, and Keyword data.
google.com/search
yoursite.com/?gclid=...
Matches GCLID
GCLID stripping occurs when a request is intercepted before reaching the final destination, and the query parameters are not explicitly passed to the new URL. This is most common in 301/302 redirects.
Server Redirects: Apache/Nginx rewrite rules that don't include $query_string or QSA flags.
CMS Plugins: WordPress security or caching plugins (e.g., "Remove Query Strings from Static Resources").
Protocol Mismatch: Redirecting from http:// to https:// often drops params if not configured correctly.
Estimated breakdown of GCLID stripping incidents by root cause.
Manually append a fake test parameter to your URL to see if it survives the load.
If the URL loads but the parameter is gone from the address bar, stripping is active.
Open Chrome DevTools > Network. Enable "Preserve Log". Click your ad link.
Look for 301/302 status codes followed by a request to a URL without the gclid.
Use terminal to check server headers directly, bypassing browser cache.
Check the 'Location' header in the response.
The solution depends on your tech stack. The goal is always to capture the query string on the incoming request and append it to the redirect target.
Comparison of methods to resolve GCLID stripping. Server-level fixes are generally more robust than plugin-based solutions.
Impact on Data Accuracy & Revenue Attribution
When GCLID is stripped, Google Analytics treats the session as "Direct/None" or "Organic". You lose campaign, keyword, and ad group data. ROAS calculations become impossible.
Preserving the parameter ensures the click is stitched to the session. This enables:
Google Ads Tracking Fix
The Google Click Identifier (GCLID) is the “receipt” that connects an ad click to a conversion.
When a redirect drops ?gclid=... (or wbraid / gbraid),
Google Ads can’t match conversions back to clicks. Smart Bidding learns the wrong lessons, GA4 sessions drift into “Direct,” and
offline conversion uploads fail.
Do not only preserve gclid. Also allowlist:
Redirects are 3xx responses with a Location header. If the redirect target URL does not include the original query string, your IDs are dropped.
Redirect chains raise the odds: http → https → www → trailing slash → app routing. One bad hop loses the IDs forever.
If your GA4 and Ads still don’t align after fixes, use a proof baseline: GA4 and Google Ads attribution alignment .
Your goal is simple: find the first redirect whose Location header does not include the query string.
Step 1
Smoke test in the browser
https://yourdomain.com/landing?gclid=TEST_123&wbraid=TEST_456If the page loads and the address bar drops the params, stripping is active.
Step 2
Chrome DevTools (redirect chain)
Step 3
curl (server truth)
curl -I -L -v "https://yourdomain.com/landing?gclid=TEST_123"Watch each Location: and find where the query string drops.
If you see 403/406 errors: it may be a WAF/security block, not a redirect strip. Check Wordfence/Solid Security logs and allowlist gclid/wbraid/gbraid.
The pattern is always the same: capture the incoming query string and append it to the redirect target. Then add a safety net so a future change doesn’t break it again.
Best practice: $is_args$args
# Redirect with argument preservation
rewrite ^/old-path$ /new-path$is_args$args permanent;
# Trailing slash enforcement (preserving args)
rewrite ^([^.]*[^/])$ $1/$is_args$args permanent;
# WordPress try_files: DO NOT drop args
# Bad: try_files $uri $uri/ /index.php;
try_files $uri $uri/ /index.php$is_args$args;RewriteEngine On
# BAD: can strip existing query string
RewriteRule ^old-page/?$ /new-page/ [R=301,L]
# GOOD: preserves query string (QSA)
RewriteRule ^old-page/?$ /new-page/ [R=301,L,QSA]WordPress can issue “clean” canonical redirects that drop unknown query parameters. Add a filter that re-attaches the tracking params.
/**
* Preserve attribution parameters during WordPress canonical redirects.
*/
function preserve_tracking_parameters( $redirect_url, $requested_url ) {
$tracking_params = [
'gclid','wbraid','gbraid','gclsrc',
'utm_source','utm_medium','utm_campaign','utm_term','utm_content'
];
$parsed = parse_url( $requested_url );
if ( empty( $parsed['query'] ) ) return $redirect_url;
parse_str( $parsed['query'], $query );
$keep = [];
foreach ( $tracking_params as $p ) {
if ( isset( $query[$p] ) ) $keep[$p] = $query[$p];
}
if ( ! empty( $keep ) ) $redirect_url = add_query_arg( $keep, $redirect_url );
return $redirect_url;
}
add_filter( 'redirect_canonical', 'preserve_tracking_parameters', 10, 2 );Even after you fix redirects, capture IDs immediately and store them. This protects you from future config changes.
(function() {
function getParam(p) {
var m = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
return m && decodeURIComponent(m[1].replace(/\+/g,' '));
}
function setCookie(name, value, days) {
var d = new Date();
d.setTime(d.getTime() + (days*24*60*60*1000));
document.cookie = name + '=' + value +
';expires=' + d.toUTCString() +
';path=/;SameSite=Lax;Secure';
}
var keys = ['gclid','gclsrc','wbraid','gbraid'];
keys.forEach(function(k) {
var v = getParam(k);
if (v) {
setCookie(k, v, 90);
localStorage.setItem(k, v);
}
});
})();If you need those IDs in a CRM or offline pipeline, see: offline conversions and CRM uploads .
Save gclid/wbraid/gbraid from cookies to order meta at checkout. Then you can export and upload conversions later.
add_action( 'woocommerce_checkout_create_order', 'save_attribution_data_to_order', 10, 2 );
function save_attribution_data_to_order( $order, $data ) {
$keys = ['gclid','wbraid','gbraid'];
foreach ( $keys as $key ) {
if ( isset( $_COOKIE[ $key ] ) ) {
$value = sanitize_text_field( $_COOKIE[ $key ] );
$order->update_meta_data( '_' . $key, $value );
$order->update_meta_data( $key, $value );
}
}
}If GA4 purchase/revenue is also off, fix it in parallel: GA4 purchase and revenue mismatches (WooCommerce) .
Validate in three places: browser behavior, server headers, and platform reporting.
Browser
Server
GA4 + Google Ads
Want this fixed end-to-end?
We’ll trace the redirect chain, patch server/CMS/CDN rules, and verify attribution alignment.