Universal Analytics and signup with Facebook

两盒软妹~` 提交于 2020-01-11 22:54:11

问题


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!


回答1:


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.




回答2:


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?




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/23923605/universal-analytics-and-signup-with-facebook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!