Analytics
2.6K members online now
2.6K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
 
Guide Me
star_border
Reply

Tracking users through OAuth without using the referral exclusion tool

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Is there a solution to tracking users through OAuth without adding the third party sites to the referral exclusion list? We recently added an OAuth funnel with GitHub and Bitbucket to our sign-up process which means we lose the original source/medium of our new sign-ups because Google starts a new session when they return to our site after going through the OAuth funnel. We can not add Bitbucket or GitHub to our referral exclusion list because we actually get referrals from these two sites outside of the sign-up funnel. What is the best solution to track our new sign-ups through OAuth without using the referral exclusion tool and without loosing the original source/medium? Here is our funnel:

 

  1. A user lands on our main domain
  2. Clicks on "sign-up" and is taken to our sub-domain (currently being tracked using the same tracking code as main site)
  3. Clicks on BitBucket or Github and is taken off our sub-domain through OAuth
  4. Returns to sub-domain

Let me know if there is any good solution to our problem. 

 

 

Tracking users through OAuth without using the referral exclusion tool

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

Hey Jaala,

did you find a solution to this problem? I'm having a similar issue. I have some ideas, but still not sure what's the best approach. I thought I would reach out in case you found THE solution Smiley Happy

 

Thanks!

Re: Tracking users through OAuth without using the referral exclusion tool

[ Edited ]
Participant ✭ ✭ ✭
# 3
Participant ✭ ✭ ✭

Hi everyone,

 

If you haven't found a solution yet, here it is:

 

First of all, you need to use GTM. Then you'll need to enable this Built-In Variable: referrer and then create this Custom JavaScript Variable:

 

function(){
  var fixReferrer = [
        '/sub/oauth',
        '/login.php',
    ];

    for (var x = 0; x < fixReferrer.length; x++) { 
        if (document.referrer.indexOf(fixReferrer[x]) > -1)
            return null;
    }
  return {{Referrer}};
}

 

Note: instead of 'sub/oauth' and 'login.php' use a referral path that you'd like to exclude. You'll find it if you look at your source / medium report and apply Referral Path as a secondary dimension.

 

After that, you'll need to add this Custom JavaScript Variable to your page view tag:

referrer in gtm.png

 

If you've configured this, OAuth referrals should start to disappear slowly but relentlessly. Those referrals will still appear in your reports as github.com/referral (and referral path you've excluded) due to the last non-direct source attribution. However, this number should steadily decline (and you should see near 0% new users) until after 6 months when it should disappear entirely.

 

Hope this helps. Let me know if it helps @Jaala S and @Jean-Philippe B.

 

Cheers,

Taavi

Tracking users through OAuth without using the referral exclusion tool

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭

This all makes sense. Can we do something similar without GTM?

Tracking users through OAuth without using the referral exclusion tool

[ Edited ]
Participant ✭ ✭ ✭
# 5
Participant ✭ ✭ ✭

Technically yes, but it's more complicated. You should contact your developer (if you're not a developer) to implement this with or without GTM. If it's not implemented properly, there's a probability that you'll break your website.


Cheers,

Taavi

Tracking users through OAuth without using the referral exclusion tool

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Thanks Taavi, I'll look it up. I'm originally a developer, I'll figure out something Smiley Happy

 

Cheers

JP

Tracking users through OAuth without using the referral exclusion tool

[ Edited ]
Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

So, here's the solution I came up with. Documentation is not super clear, so I had to play with stuff a bit. It's not in prod yet on gemnasium.com but should be sometime today, and I should be able to confirm it works as expected in a day or so.

 

 

ga(function(tracker) {
originalReferrer = tracker.get('referrer');
// https://github.com/ -> this is the referrer when the user already gave authorization to Gemnasium in the past.
// https://github.com/login/oauth/authorize -> this is happening when people are seeing the autorization screen on GitHub.
if (originalReferrer === 'https://github.com/' || originalReferrer === 'https://github.com/login/oauth/authorize') {
ga('set', 'referrer', null)
};
});

 

 

Hope that helps!

Tracking users through OAuth without using the referral exclusion tool

Participant ✭ ✭ ✭
# 8
Participant ✭ ✭ ✭

That's great @Jean-Philippe B. Let us know if it works.


Cheers,

Taavi

Tracking users through OAuth without using the referral exclusion tool

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

It works as expected so far. All conversions have their original referrers. 🤘

Tracking users through OAuth without using the referral exclusion tool

Participant ✭ ✭ ✭
# 10
Participant ✭ ✭ ✭

Cool! That's great Jean. Glad you found the solution. Smiley Happy


Cheers,

Taavi