I'm using LinkedIn's Single Sign On, and when they redirect authorized users back to my site, the referring domain is "linkedin.com".

For Google (accounts.google.com) I can simply exclude that referral domain, but since Linkedin doesn't use a subdomain, I can't just exclude linkedin.com as that would block valid traffic.

so, how can I exclude this specific traffic from being tracked as a referral for events in Google Analytics?

  • 1
    Are you able to append parameters to the returnURL? If so, try using utm_source=direct&utm_medium=none – Bronwyn V Sep 5 '19 at 14:13
  • Good idea, but unfortunately not. One thing I could do is redirect to a temporary URL and then redirect with utm params. But that's a ton of work all because linkedin's SSO uses their root domains :-/ – d-_-b Sep 6 '19 at 2:18
  • 1
    If you look at the full referrer for these traffic sources (e.g. applied as a secondary dimension), is there an SSO specific link for this traffic, that is different from normal Linkedin referral source? E.g. /oauth2/ or something unique to it? – kgrg Sep 6 '19 at 5:04
  • @kgrg yes, it's linkedin.com/oauth/v2/login-success – d-_-b Sep 7 '19 at 15:02

You can solve this problem for LinkedIn the same way that I solve it for Facebook. When traffic comes back to your site after sign-in, strip the referrer before Google Analytics executes.

Specify your return-to URL from linked in as a page with a meta-refresh to your final return URL:

<meta http-equiv="refresh" content="0; url=/after-login.html">

This meta refresh will strip the referrer, or change it to be from your own site. Then Google Analytics won't see the LinkedIn referrer and it won't mess up your stats.

Source: When using Google and Facebook for social login, how to prevent misattributed session referrers and goal conversions in Google Analytics?


Under admin, go to Property > Tracking Info > Referral Exclusion List.

Add linkedin.com as an excluded referral. This should ignore the referrals from LinkedIn and (from my experience), will retain the referral information from the initial session.

Word of warning, Google's own advice on this feature is:

These settings only work with the analytics.js version of the tracking code. If you’re using the ga.js version, configure these settings in your code. If you’re transitioning to analytics.js from ga.js, customise these settings to match your previous configuration for data continuity.

  • 1
    Unfortunately as per the initial post. using the referral exclusion list will result in all traffic from linkedin being seen as direct traffic (not just the traffic from the SSO) – Bronwyn V Sep 5 '19 at 13:25
  • 1
    @BronwynV, that will teach me to read the question more carefully. – GeoffAtkins Sep 5 '19 at 13:48
  • 1
    It's nice to know I'm not the only one that does it! ;-) – Bronwyn V Sep 5 '19 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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