Universal Analytics and signup with Facebook
Asked Answered
E

4

15

I have a website (theneeds.com) that allows signup via Facebook. We're running several campaigns, e.g. on Facebook itself, and we'd like to properly track signups from the different campaigns.

The problem is with Universal Analytics: when a user signs up with Facebook, she triggers a new session thus loosing the campaign reference.

Two possible solutions are:

  1. remove the analytics tracking on the signup form (i.e. the page that causes the new session to start)
  2. add facebook.com to the referral exclusion list

Unfortuantely both have disadvantages, so I'm wondering if there is any best practice or better solution.


More details follow.

From "Universal Analytics usage guidelines"

By default, all referrals trigger a new session in Universal Analytics https://support.google.com/analytics/answer/2795983

Here's an example of a campaign sent to Facebook:

http://www.theneeds.com/?utm_source=facebook&utm_medium=social&utm_campaign=_mycampaign

And here's what happens.

  • When a user clicks, she opens theneeds.com with source, medium and campaign properly set.
  • The user now clicks on Join and select Facebook [1], she's redirected to facebook.com for authorization.
  • After successful authorization [2], she's redirected back to theneeds.com, with referral facebook.com (or m.facebook.com, on a mobile device).
  • This triggers a new session in Universal Analytics, loosing information about the campaign.
  • The user is now on the signup form and, after submission, is redirected to the page that marks the analytics goal.
  • Unfortunately, the goal is registered as facebook.com/referral, and not as facebook/social/_mycampaign.

Notes:

[1] I've used Facebook as an example to simplify the discussion. Clearly the same happens with Twitter, Google, and any other oAuth provider.

[2] In order to test, one needs to make sure that the user has NOT already authorized the website on Facebook so that she actually sees pages on facebook.com (which is the usual case for new users) - if the user is already authorized, she's immediately redirected back to the website and there's no change in the referral, so the campaign is properly tracked.

I've tested the 2 solutions mentioned above.

  1. Remove the analytics tracking on the signup form - whose disadvantage is that I'm loosing page tracking
  2. Add facebook.com to the referral exclusion list - that result in loosing the actual referral traffic from Facebook (e.g. as a result of user shares).

Decorating links is also a non-viable solution as the user might have a look at the website before deciding to signup, so I should propagate decoration on all links.

A better solution would be to temporarily disable the referral on the signup form, but I'm unsure if this is possible in Universal Analytics.

Any suggestion? Thank you in advance!

Encyclical answered 28/5, 2014 at 23:45 Comment(0)
S
7

I'm having the same issue. I'm still researching solutions, but one option I'm considering is this one: https://groups.google.com/forum/#!msg/google-analytics-analyticsjs/NtwQFQAZ2Oo/kh-T0c1eHCYJ Essentially, that author recommends that before you send the user to FB, you set a session variable to remind yourself "hey, next time you see this guy, be sure to overwrite his referrer". Then on every pageview, you check for that session variable. When set, you do:

ga('set', 'referrer', 'http://subdomain.site.com/facebooksigninreturn');

According to the author, that's supposed to prevent a new session from being created.

Stereogram answered 4/6, 2014 at 14:36 Comment(5)
Thanks. I guess many people will realize that they have this issue soon :) I'll try the solution (I probably don't even need the session) and share the result.Encyclical
Confirmed, it works. In my solution: 1. I don't need the session - I just set the fake referrer on the pages returning from Facebook auth; 2. I don't need the subdomain, www.site.com just works fine.Encyclical
This seems like a hacky solution, because now you have no idea who the actual referrer is. What if you are using Facebook ads to drive traffic to your site, and then Oauth with facebook? Then you will have no way to track that. Is there any other solution?Orchestrate
@FletchRichman, sorry I missed the notification - it actually works exactly in your use case. When the user first arrives, the visit starts with the correct referral, e.g. from the ad. When the user logs in via oAuth, by setting a fake referral you simply don't start a new visit, and you're not loosing any information. It's just the referral of the return page that is faked, not the original one that initiated the visit.Encyclical
The FB connect app appends the following hash to the return URL: #_=_ — see here: #7132409 — for that reason you don't need a cookie, you can detect that hash insteadIsley
P
1

One potential problem with this approach is that if the user had another original referrer (say google), overriding the referrer seems to lose the original referral source. I experimented with setting

ga('set', 'referrer', '(direct)');

Since google attributes to the last non-direct source, this appears to work. Can anybody confirm if this approach is valid?

Pulver answered 9/9, 2016 at 17:15 Comment(0)
F
1

I've made some test on my side about this.

For information, 3DS credit card verification (for europeen country) is also affected since the user is redirected to bank url and come back to your website for paiement confirmation (So top referrer in my ecommerce funnel !! :S)

Looking at Google analytics real time > traffic source. It's seems that using a referrer like

ga('set', 'referrer', 'www.mydomain.com');

changed the referrer to www.mydomain.com but don't create a new session. It's also the same for OAuth Login that changed the referrer to socials Facebook.

I'm using the solution to set referrer to my actual domain for now since it's better than worst actual situation.

I will wait for fresh data on normal account (not the real time) to see what will be the result.

Fromm answered 9/3, 2018 at 17:19 Comment(0)
I
1

If you're OK with popups, try changing OAuth flow.

When I follow FB Login API example OAuth dialog opens in a popup window. Such OAuth flow will remove your issue with GA, because there will be no redirect from FB back to site.

Most of OAuth providers that I know also support opening a dialog in a popup window.

Impulsion answered 28/8, 2018 at 23:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.