Access Facebook user profile data with FB Login
article, uncategorizedAccess Facebook user profile data with FB Login
Use Facebook user profile data to populate your analytics reports
Have you ever wanted to have in-depth details about your website visitors or app users?
If your users “login with Facebook” and login to your site with their Facebook credentials, you can access valuable profile data.
In this article, we will discuss and explain two topics
a) How to access Facebook visitor data and
b) How to insert it this data into your Opentracker web analytics reports.
This data is available when a visitor/ user is logged in with Facebook login details.
Q: How does it work?
A: When your visitors login to your site or app with their Facebook identity, you collect user information which you can access via our api. This information can then be shown in the Opentracker reporting system, and populate Visitor Profiles.
Additionally, you can then search through all of your data to match or locate any visitors or variables that interest you.
Furthermore, note that due to the technical nature of this article, knowledge on javascript and Facebook api [1] are required. In this example, we will collect information on the visitor’s gender.
The Javascript used to collect visitor Facebook profile information
function login() { FB.login(function(response) { if (response.authResponse) { // connected console.log("FB.login connected"); window.location.reload(); } else { // cancelled console.log("FB.login cancelled"); } }, fbscope); } window.fbAsyncInit = function() { FB.init({ appId: '123456789012345', // App ID channelUrl: '//staging.pdfmyurl.com/facebook.channel.html', // Channel File status: true, // check login status cookie: true, // enable cookies to allow the server to access the session xfbml: true // parse XFBML }); // Additional init code here FB.getLoginStatus(function(response) { if (response.status === 'connected') { // connected console.log("FB.getLoginStatus connected"); sendUserInfo(); } else if (response.status === 'not_authorized') { // not_authorized // User logged into FB but not authorized console.log("FB.getLoginStatus not_authorized"); } else { // not_logged_in // User not logged into FB console.log("FB.getLoginStatus not_logged_in"); } }); }; function sendUserInfo() { FB.api('/me', function(response) { //console.log("my object: %o", response); var map = new OTMap(); //map.put("username!", response.username); map.put("gender!", response.gender); OTLogService.sendEvent("user logged in", map); }); }The above javascript code snippet is triggered when a user clicks on a login button on your website. When the user has logged in via the pop up window, and successfully authorized, a custom event is sent to opentracker [7]. Note the exclamation mark on the map key. This is the start of the journey to collect user information on your site. To learn more about what user information can be collected, please refer to the facebook api [8] [9] [10]. Here are a few examples from the facebook api [2] [3] [4] [5].
In order to see what data has been collected for your site, login to http://ot3.opentracker.net and navigate to visitor online and visitor clickstream. Below are screenshots illustrating the example from this article, implemented in the Opentracker reporting system. Please note that the gender has appeared in the visitor profile.
The illustration above shows us Opentracker visitor engagement reporting with clickstream enhanced visitor profile including a visitor gender.
The illustration above gives us two pieces of information: the gender and the login status (login event), derived using a “login with facebook” event.
References
[1] https://developers.facebook.com/apps/
[2] https://web.archive.org/web/20200203213418/http://www.fbrell.com/auth/account-info
[3] https://web.archive.org/web/20200129213616/http://www.fbrell.com/fb.api/does-like
[4] https://web.archive.org/web/20171226151555/http://www.fbrell.com/fb.api/everyone-data
[5] https://web.archive.org/web/20161106191718/http://www.fbrell.com/fb.api/friends
[6] http://pdfmyurl.com/js/facebook.js
[7] http://api.opentracker.net/api/inserts/browser/javascript_implementation.jsp
[8] https://developers.facebook.com/docs/reference/javascript/FB.api/
[9] https://fbdevwiki.com/wiki/FB.api
[10] https://developers.facebook.com/docs/reference/javascript/
The difference between Customer Journey vs. Buyer Journey can best be summed up as: The difference between Attraction and Retention.
The Buyer Journey is all about the steps a person takes before making a purchase.
The Customer Journey is about developing a relationship or customer experience with a person after purchase.
The word ‘journey’ is relevant for both customers and buyers.
The Customer’s Journey starts when the Buyer’s Journey ends.
A good analogy might be a race track. You run a race and you win a buyer. Now you running around the same track, win another race and sell something more to that customer.
Can it hurt your bottom line to not understand the difference? Of course. The big secret is that it costs more to gain a new customers (CPA – cost-per-acquisition) than to keep existing clients, both in terms of money and effort.
Heck, if you do your math right, you can even make a loss with your first sale to acquire a customer.
Think of it as running another lap around the track just one more time, instead of learning a whole new sport.
The point is that we are always on the lookout for the next campaign or promotion. Looking for new customers. It is tempting to keep thinking of new hooks and pain points.
Looking for new customers and keeping existing buyers engaged should both keep happening. But keep in mind that they are different funnels and require different strategies (call to action, offers, pricing, etc.).
Bottom line: approach these two types of engagement differently, be aware that they exist and require different hats.
Want to know how to differentiate the buyer journey from the customer journey? Click below to book a complimentary strategy session.
Schedule A Call