Skip to content
FunnelGuard

Fix guide by FunnelsGuard

_gl parameter stripped by redirect: how to find and fix it

TRK-315High impactDetectedBy FunnelGuardPublished Updated
On this page

What this issue is

When a visitor clicks from your main site to another domain you own or use (a booking tool, a checkout, a separate shop), Google tags can add a _gl parameter to the link. It carries the visitor's GA4 client ID and session details. The page on the other side reads it and carries on with the same visitor instead of starting a new one.

Where the _gl value is lost
  1. Ad clickVisitor lands on your main site with gclid and UTMs
  2. Link to booking domainGoogle tag adds ?_gl=... to the link
  3. Destination redirect301 or 302 drops the query string
  4. Tag reads _glNothing to read, so a new client ID is created
  5. ConversionCredited to direct or the booking tool, not the ad

The link is built correctly, but the redirect on the destination removes the parameter.

Why it costs you leads or sales

The booking or purchase still happens, so you may not notice anything wrong. But GA4 sees two visitors: one who clicked the ad and left, and one who arrived from nowhere and converted. The conversion is credited to direct traffic or to a referral from your own site.

Where the same 100 conversions get reportedExample numbers
Where the same 100 conversions get reported (example)Paid search (redirect strips _gl): 35 conversions; Direct / referral (redirect strips _gl): 65 conversions; Paid search (_gl kept): 92 conversions; Direct / referral (_gl kept): 8 conversions035713565928Paid search (redirect…Direct / referral (re…Paid search (_gl kept)Direct / referral (_g…conversions

Example: illustrative numbers for 100 real conversions from paid search, before and after the redirect is fixed.

How to check if your site has it

Test the journey by hand
  1. Open your main site in a private window

    Use a URL with test UTMs, for example ?utm_source=test&utm_medium=cpc. Accept cookies so the tags run.

  2. Click the link to the other domain

    Before the page finishes loading, look at the address bar. A working link contains _gl=... in the URL.

  3. Check the final address

    If the page loads but the address no longer contains _gl, a redirect removed it.

  4. Trace the redirect chain

    Open DevTools, go to the Network tab, tick Preserve log and reload. Look at each 301 or 302 and its Location header. Does it include the query string?

  5. Compare the client ID

    In GA4 DebugView, or in the Network tab on a request to google-analytics.com, check that the cid value is the same on both domains.

See where a redirect sends a _gl linkbash
curl -sIL "http://book.example.com/?_gl=1*test*&utm_source=test" | grep -iE '^(HTTP|location)'

If a location: line in the output lacks _gl=, that hop is the one stripping it.

How to fix it

There are two routes. The best one is to remove the redirect from the link, so the visitor lands on the final URL straight away. If the redirect must stay, change it so it passes the query string on.

Fix the redirect
  1. Link to the final URL

    Use the exact https, correct host (www or not) and trailing-slash version that loads without redirecting. Update the links on your site that point to the other domain.

  2. Find every redirect on the destination

    Check the host or CDN, the server config, a redirect plugin or app, and any language or login rule.

  3. Make each redirect keep the query string

    Use the platform settings below.

  4. Check the cross-domain setup

    In GA4 go to Admin > Data streams > your stream > Configure tag settings > Configure your domains, and make sure the destination domain is listed.

  5. Retest

    Repeat the manual check and confirm _gl is still in the final address.

Keep the query string on redirects, by platform
  1. Nginx

    Use $request_uri (or $is_args$args) in the return: return 301 https://www.example.com$request_uri;

  2. Apache .htaccess

    Add RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L,QSA]. Without the target containing a ?, Apache keeps the original query string by default. Do not add a trailing ? to the target, because that clears it.

Redirect behaviour

Before

  • Link goes to http://book.example.com/?_gl=...
  • Server redirects to https://www.book.example.com/ with no query string
  • GA4 starts a new session

After

  • Link goes straight to https://www.book.example.com/?_gl=...
  • No redirect, or a redirect that keeps the query string
  • GA4 continues the same session

How to confirm it's fixed

Confirmation checks
  • The final address after the click still contains _gl=
  • The curl command shows every location: header keeping the query string
  • GA4 DebugView shows the same client ID on both domains
  • A test conversion on the destination is credited to the original source and medium
  • The destination domain no longer shows up as a referral in your reports

How to prevent it happening again

Habits that keep _gl intact
  • Link to final URLs, not to versions that redirect
  • Re-test the cross-domain click whenever you change domains, hosting, a CDN rule, a redirect plugin or a booking tool
  • Keep a list of every domain in the journey and the redirects on each
  • Ask developers to use query-string-preserving redirect rules by default
  • Run the full journey on a schedule so a new redirect is caught within a day, not after a month of bad data

How FunnelGuard handles this

FunnelGuard detects this issue today. A robot visitor runs your real journey on a schedule, follows the click to the other domain and checks whether the linker parameter is still on the page you land on. It also checks the tracking hits sent to GA4 and other platforms at each step. If a check fails, it is re-checked from a second region before one alert goes out with a screenshot and a likely cause.

Test traffic is marked with utm_source=funnelguard and fg_test=1, never clicks real ads and stops before payment. The Free plan covers 1 site and 2 journeys with daily checks and no card, and paid plans have a 3-day free trial.

Questions people ask

Why is my _gl parameter missing after a redirect?

A redirect on the destination domain is probably sending visitors to a new address without the query string. This often happens with http to https, www to non-www, trailing-slash, language or login redirects. The tag on the page then finds no _gl value and starts a new session.

What is the _gl parameter in Google Analytics?

It is a cross-domain linker parameter that Google tags add to links between your domains. It carries the visitor's client ID and session data so GA4 can treat both sites as one visit.

How do I stop a redirect removing query parameters?

Change the redirect rule so it passes the query string on, for example using $request_uri in Nginx or the QSA flag in Apache rewrite rules. Better still, link directly to the final URL so no redirect runs.

How can I tell if a redirect is stripping _gl?

Click the cross-domain link and watch the address bar, or run curl -sIL on the link and read each location header. If the first URL has _gl and the final one does not, a redirect removed it.

Why does my booking tool show as a referral in GA4?

Often because the linker value was lost, so GA4 treats the arrival from your site as a new visit with your site as the referrer. Check that the domain is listed in your cross-domain settings and that no redirect removes _gl.

Is a missing _gl the same as cross-domain tracking not being set up?

No. If the link never contains _gl, the setup is missing or wrong. If the link has _gl but the final page does not, a redirect or script after the click removed it.

Can FunnelGuard detect a stripped _gl parameter?

Yes. FunnelGuard runs your real journey on a schedule and checks whether the linker parameter survives the click to the other domain. A failure is re-checked from a second region before you get an alert.

Does FunnelGuard catch this?

Detected

FunnelGuard checks for this today.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.