Recording Facebook Data within Custom Analytics (Deprecated)

If your users log into your site through Facebook Connect, you have access to their basic information (demographics, education, work history, likes or preferences, and more).

Warning: The v2 Analytics API has been deprecated. See Ooyala IQ Analytics for more details on the new v3 Analytics API.

The following is an example of the type of information you can obtain from Facebook Connect:    

which returns a response similar to the following:

   "id": "220439",
   "name": "Bret Taylor",
   "first_name": "Bret",
   "last_name": "Taylor",
   "link": "",
   "username": "btaylor",
   "gender": "male",
   "locale": "en_US"
Note: For more information about how to use Facebook Connect, refer to the Facebook Developers site.

The following example describes how to create record a user's gender based from Facebook data using JavaScript.

  1. Create a tag for each piece of information to record. In this example, you create a male and female tag.

    The following example creates a male tag:

    [PUT] /v2/analytics/tags/male{
       “display_name”: "Male"

    The following example creates a female tag:

    [PUT] /v2/analytics/tags/female{
       “display_name”: "Female"
    If the requests are successful, Backlot returns a 200 response.
  2. Initialize FB.api and make sure the user is logged in. For more information, refer to the Facebook JavaScript SDK.
  3. Embed the client code that records the male or female tag through the playerAPICallback call.

    The following example code gets the gender of the user by making a call to the Facebook API and records the gender each time the playerAPICallback call is made.

    var tags = new Array();
    FB.api( "/me", function(response) {
    	tags[0] = response.gender;
    function playerAPICallback(playerId, eventName, eventParams) {
    				"tags": tags
  4. Embed the client code that embeds the player, specifying the OnCreate embedded parameter with the name of your previously defined function playerAPICallback. The following is a basic example of a player V3 creation. The third argument is a hash of name/value pairs (detailed in the Player API Reference).
      window.player = OO.Player.create('playerwrapper','w3ZHc0Njr33Tdp-RRcwfZMjaOrmzOP82', {
        onCreate: window.playerAPICallback, 

You can begin viewing the results through the Backlot UI or Backlot API.