I'm managing a Google Analytics implementation on a fairly large e-commerce site. We're a big enough site to have multiple subdomains... So, we have:

  • www.ourshop.com
  • www.community.ourshop.com
  • www.help.ourshop.com

Unfortunately, we are seeing a significant amount of self-referral traffic from these sub-domains, and our understanding is that this will dramatically impact all of our session and attribution metrics. Since we're using Universal Analytics, we added all of the domains and subdomains (without the WWWs) to the referral exclusion list in GA. Unfortunately, no dice. We're still getting tons of self referrals.

Additional notes: All of our sites push users over to HTTPS by default. Also, we have a reasonably large number of 301 redirects throughout the site to push people from old URLs to new, or to send them from HTTP to HTTPS, etc.

How can we eliminate the self-referrals?

1 Answer 1


To exclude refferals you could add only top level domain - ourshop.com.

You could use also that code:

function() {
    var theReferrer = document.referrer;
    if (theReferrer) {
        var myProtocol = theReferrer.match(/(https?:\/\/)/);
        var myDomain = theReferrer.match(/\/\/tatooine\.com(.+)/);
        var mySubdomain = theReferrer.match(/\/\/(.+)\.tatooine\.com(.+)/);
        var myPath = "";
        if (mySubdomain) {
            if (mySubdomain[2]) myPath = mySubdomain[2];
        // exclude referrals from the jobs subdomain
        // see referrals from all other subdomains
            if (mySubdomain[1]=="jobs") { 
                return myProtocol[1]+"jobs.tatooine.com"+myPath;
            } else {
                return myProtocol[1]+mySubdomain[1]+".tatooinetheplanet.com"+myPath;
        // keep the else-if statement to see referrals from the main domain
        // remove it to exclude referrals from the main domain
        else if (myDomain) { 
            if (myDomain[1]) myPath = myDomain[1];
            return myProtocol[1]+"tatooinetheplanet.com"+myPath;
    return document.referrer;

More info: http://www.lunametrics.com/blog/2014/06/19/missing-referral-traffic-universal-analytics/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.