Google analytics and Oauth (Facebook login) - google-analytics

TL;DR;
Facebook login makes the original referral URL change since and in GA it will look like they originally came from a Facebook.
We have the following problem using Google Analytics (UA) for Facebook (Oauth) login:
user lands on /page/1?utm_campaign=aaa and GA session is created with correct initial referrer, campaign etc.
user visits a few other pages and decides to register using Facebook
Facebook login makes the user's browser to go to facebook and come back which changes the referral and thus creates a new GA session
When user lands back on our callback url we fire an event that is converted to goal in GA
The problem is that all users who register using Oauth have the referral set to Facebook and the landing page to the page where they land after Facebook's callback because that's when GA "resets" the session :( .
Is there a way of joining the two sessions in GA and making it know that it is the same user all the time so that Facebook registers keep the full information on initial referrer, landing page, UTMs etc. ?

Follow FB SDK example and OAuth dialog will open in a popup window.
It will remove the issue with GA.
Most of OAuth providers that I know also support opening a dialog in a popup window.

Related

Universal Analytics and login redirect

As part of user flow on my site, user is redirected to a different domain that is not under my control, where he logs in and is then redirected back to my site.
Google analytics fail to correctly display the user flow, showing the callback URL as a new landing page, which is obviously wrong.
I am considering rewriting referrer on the callback page, but it seems like a very hacky solution to a common problem.
Is there a standard way to connect the flow after a redirect?
You must enter the domain of that site in the Referral exclusions list in the Properties settings.

Google Analytics referral sources

We're using Google and Facebook SSO allowing our users to sign up and login with these services. However, if a user signs up or logins in with either service (rather than creating a standard email login), we lose the referral source in Google Analytics -- and, instead, sign up and upgrade sources are attributed to accounts.google.com or Facebook.com. Anyone have some thoughts on a workaround?
This requires some backend work. Whenever one of your users clicks on the login button with either services, you backend should 'remember' him using a cookie or any other parameter. In that way whenever he comes back from exactly the url of your Facebook SSO or accounts.google.com you should set the GA tracker referrer parameter to the one of your site's URL. You can do this in basic js code like this
ga('set', 'referrer', 'mydomain.com');
In this way you won't see these invalid referrals anymore.

Email signup confirmation. Keep track with Google Analytics

in the site in which I'm working the registration is mandatory to complete an order (is an ecommerce site). In the registration process, users have to fill in a registration form and then submit it. An email will be sent to users to confirm the account. After the confirmation (click on a link sent through email) the account is active.
I would to keep track of the user which complete the registration and then confirm his account clicking on the confirmation link in the email.
Basically, my questions are :Do users which submit the registration form, confirm their account? then, Do users which confirm their account make a purchase on the website?
I know how to track the submitting of the form (with event tracking or destination goal, it depends), but I don't know how to put a trackable link in the confirmation email. I can't use URL Builder, because the confirmation link is generated automatically and it depends on the account itself (each link is unique for the account). How can I keep track of it?
One solution for you is to include a Google Analytics _trackEvent call on the email activation page. Docs here:
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
This is the method we use to do something similar on our site.

ajax rating control with facebook login

I have a video website. I want the users to vote for the videos with their facebook ids. What i want is to put an ajax rating control under videos. If the user is currently logged in on facebook, when the user clicks the control to rate the video i want to get the user id of the facebook user. If the user is not logged in I want to show a modal popup for facebook login and get the user id after user is logged in.
Any help would be appreciated.
Thanks.
If I am not wrong you will have to go all the way and create an App in Facebook and integrate it with your site.
You may first want to check the Javascript SDK
http://developers.facebook.com/docs/reference/javascript/
If that doesn't work, I have a blog article that does the full server side integration
http://theocdcoder.com/tutorial-integrating-facebook-authentication-asp-net-mvc-3/

is there anyway to programatically get the data on a group's facebook wall through the API without having to popup a login screen

i have a group page. i am creating a website for the group and they want to be able to see the recent facebook updates (what you see on the group's facebook wall) on their website.
is this possible without having to have a facebook popup login and just programatically pass in my login information?
You cannot programatically fill in login information, that is against the Facebook terms and conditions. You can, however, authenticate as an application as opposed to a user.
Use the following method:
Make a GET request to:
https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=CLIENT_ID&client_secret=CLIENT_SECRET
Facebook returns:
access_token=SOME_TOKEN
Use this token as your access token and it should allow you to access the group. I have tested this with my application and can confirm it works.
You request the wall information via the request:
https://graph.facebook.com/GROUP_ID/feed?access_token=SOME_TOKEN
This will not pop up any login screens as you are not required to be logged in to view a public group. Ensure your privacy settings are public for the group as well.

Resources