The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Local Website Optimization
    4. Capturing HTTP referrer in GA when a 301 is stripping the source parameters

    Capturing HTTP referrer in GA when a 301 is stripping the source parameters

    Local Website Optimization
    2 2 90
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Saatchi_HU
      Saatchi_HU last edited by

      Good day,

      To make a long story into a short one - have you ever had any experience or encounter where you've needed GA to capture the HTTP referrer of your traffic before a 301 redirect script triggers (and thus strips the original source of traffic)?

      I am working with a multitude of sites where the TLD redirects to a language directory, and because many of the referring sites and sources of traffic come into the TLD and then hit a 301, the referring source is then lost and most of this then shows as Direct traffic to the language directory (the effective 'home page').in GA.

      Would sincerely appreciate any inputs you might have about how to effectively capture these sources as a workaround. I'm probably in need of a smart analytical fix, a clever tagging method or some development amendment that is unfamiliar to me. For the sake of this discussion, building the TLD up to an existing page is not a viable or feasible fix in this instance.

      Thank you!

      1 Reply Last reply Reply Quote 0
      • AndersS
        AndersS last edited by

        Hi!

        Are you using clientside or serverside redirects? Since you talk about 301, I assume you use serverside redirects. I think if the rewrite rule is setup correct, then it should preserve the referrer info. But if this is added as e.g. utm_source parameters to the URL, then perhaps you can experiment with the flags set for the redirect rule?

        Assuming you are working with an Apache server: Looking at https://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa, it looks as if parameters can be kept/appended to the target URL. Else, the setting [L,R=301] should probably work OK with regards to keeping the referrer.

        Hope this helps 🙂

        Best regards,
        Anders

        1 Reply Last reply Reply Quote 1
        • 1 / 1
        • First post
          Last post
        • Different variations of my site (www ; non www ; https ; http) have different authority status
          GastonRiera
          GastonRiera
          0
          2
          1.1k

        • Google still indexing home page even after with 301 - Ecommerce Website
          David1986
          David1986
          0
          3
          135

        • Moving from html to wordpress site - 301's
          sfrediktru8
          sfrediktru8
          0
          3
          205

        • Best Sources for Advertising Commercial Real Estate?
          0
          1
          313

        • How best to clean up doorway pages. 301 them or follow no index ?
          CleverPhD
          CleverPhD
          0
          5
          401

        • Best practices for 301 redirect to a new location website.
          Vspeed
          Vspeed
          0
          4
          116

        • Where should I 301 redirect my current domain to given this situation?
          MeasureEverything
          MeasureEverything
          0
          3
          179

        • Can to many 301 redirects damage my Ecommerce Site - SEO Issue
          DonnaDuncan
          DonnaDuncan
          0
          2
          337

        Get started with Moz Pro!

        Unlock the power of advanced SEO tools and data-driven insights.

        Start my free trial
        Products
        • Moz Pro
        • Moz Local
        • Moz API
        • Moz Data
        • STAT
        • Product Updates
        Moz Solutions
        • SMB Solutions
        • Agency Solutions
        • Enterprise Solutions
        • Digital Marketers
        Free SEO Tools
        • Domain Authority Checker
        • Link Explorer
        • Keyword Explorer
        • Competitive Research
        • Brand Authority Checker
        • Local Citation Checker
        • MozBar Extension
        • MozCast
        Resources
        • Blog
        • SEO Learning Center
        • Help Hub
        • Beginner's Guide to SEO
        • How-to Guides
        • Moz Academy
        • API Docs
        About Moz
        • About
        • Team
        • Careers
        • Contact
        Why Moz
        • Case Studies
        • Testimonials
        Get Involved
        • Become an Affiliate
        • MozCon
        • Webinars
        • Practical Marketer Series
        • MozPod
        Connect with us

        Contact the Help team

        Join our newsletter
        Moz logo
        © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
        • Accessibility
        • Terms of Use
        • Privacy