If you using Facebook, Twitter, Github or any other service to autenticate your users, you may have noticed that they end showing up as referral traffic from the oauth service.
User lands from CPC -> Logs in -> Respawns a new visit as referral
We could think on adding those domains to the ignored referrals within our view configuration, but this will and hidding the real referal traffic from those networks.
![oauth_post_01](https://www.thyngster.com/wp-content/uploads/oauth_post_01.png)
The screenshot above is an example for the referral paths for the domain facebook.com. We only want to avoid the ones that comes from certain paths and not the whole domain.
Simo posted above How to implement the referral exlusiong using GTM some days ago, and it’s kinda similar to what I did some time ago in one implementation to get ride of fake referrals traffic from Facebook Login.
![oauth_post_02](https://www.thyngster.com/wp-content/uploads/oauth_post_02.png)
For doing this we’ll only need to take a look to the referrals paths for the domain note the ones we want to ignore, and then use create a new variable on Google Tag Manager.
![oauth_post_03](https://www.thyngster.com/wp-content/uploads/oauth_post_03.png)
Note that we’ll need to enable the built-in Variable in Google Tag Manager, configure the fixFBarr array with our paths. This variable will return “null” as the referrer when the paths match the ones we want to ignore, and will continue returning the original referrer is there is not match.
CODE
function(){ var fixFBarr = ['/dialog/oauth', '/v2.1/dialog/oauth', '/login.php', '/v2.1/dialog/oauth/read' ]; for (var i = 0; i < fixFBarr.length; i++) { if (document.referrer.indexOf(fixFBarr[i]) > -1) return null; } return {{Referrer}}; }
It will be a good idea instead of checking the path to check a combination of domain + paths array. If someone if interested on it, drop a message in the post and I’ll publish a full script covering this option.
Now, we just need to set the referrer value for our pageview tag as follows:
![oauth_post_04](https://www.thyngster.com/wp-content/uploads/oauth_post_04.png)
Ok, we’re ready right after publishing all the traffic from Facebook/Twitter/Github or any other oAuth provider will start to dissapear slowly but relentlessly.