Learn business growth with Google Analytics 4 Forums Google Analytics 4 Harnessing GA4: Eliminating Automatically Appended _gl=xxxxxxxxx Suffix from External Links

  • Harnessing GA4: Eliminating Automatically Appended _gl=xxxxxxxxx Suffix from External Links

    Posted by Alex on 26 November 2022 at 5:33 pm

    Alright, I need to figure out how to stop GA4 from automatically attaching these “_gl=xxx” tail ends to all my external links. I feel like I’ve tried everything, from disabling “click” event tracking to turning off automatic event detection, and even user-provided-data.

    I even modified the js tracking code a bit, check it out:

    <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'G-XXXXXXXX', { 'linker': {
        'domains': ['midomain.com'],
        'decorate_links': false
      }
      });
    </script>
    

    I had my fingers crossed that this would turn off the tracking of external links, but no luck.

    Just FYI – my site’s got no additional tagmanager configurations or any code/service that might be adding that pesky suffix to my links. When I turn off GA4, they all vanish, so I know it’s the culprit.

    Any of you have a workaround I could try? I’d really appreciate it!

    Scarlett replied 1 year ago 3 Members · 2 Replies
  • 2 Replies
  • Amelia

    Member
    13 March 2023 at 6:48 pm

    The “_gl=xxx” you are seeing is a client/session ID. It’s added by GA to keep IDs consistent across top-level domains, which is a part of cross-domain tracking. Your current setup may be incorrectly flagging all domains for cross-domain tracking, which could be causing the issue.

    Here’s how you can address it:

    1. Go to Admin and click on Data Streams in the Property column.
    2. Next, select Web and then click a web data stream.
    3. In the web stream details, navigate to the bottom and click on Configure tag settings.
    4. In the Settings section, click on Configure your domains.

    This should help you resolve the issue. However, if you still need cross-domain tracking but wish to remove the URL parameter that GA adds, this would require backend support. In that case, your backend would have to maintain the connection and set the GA cookie. It might be a bit complex to set up, but the result is a clean and elegant front-end without the pesky link suffixes.

  • Scarlett

    Member
    2 May 2023 at 7:08 am

    Unfortunately, there is not currently a way to stop Google Analytics 4 (GA4) from automatically attaching “_gl=xxx” to the ends of your external links. This is an automated feature of GA4 and there are no settings or configurations that can turn it off. You’ve done everything correctly in your JS tracking code, but the “decorate_links” parameter doesn’t actually exist in GA4, which is why it’s not working. The best workaround at the moment would be to use a URL cleaning function to remove the parameters when needed. For example, if you’re using Google Tag Manager, you could create a Custom JavaScript variable that cleans the URL before sending it to GA4.

Log in to reply.