开发者

How to know when a user sends an apprequest to their friends

开发者 https://www.devze.com 2023-04-01 04:54 出处:网络
I have an \"invite friends\" mechanism with Facebook\'s FB.ui({method: \'apprequests\', message: \'Come join me...\'}) popup dialog.I want to know the stats of users a开发者_如何转开发ctually completi

I have an "invite friends" mechanism with Facebook's FB.ui({method: 'apprequests', message: 'Come join me...'}) popup dialog. I want to know the stats of users a开发者_如何转开发ctually completing the invitation process. Normally I subscribe to Facebook events through this process:

  FB.Event.subscribe('edge.create', function(targetUrl) {
      _gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]);
  });

There I'm subscribing to the event for when users like something and sending that to Google Analytics according to Facebook's subscribe documentation.

I'd love to use this same mechanism for apprequests, but there's no Facebook event for that on the above documentation webpage. Is there another way? Is there an event I'm unaware of?


Unlike with Like buttons, you can actually just use a direct callback.

FB.ui({method: 'apprequests', message: 'Come join me...'}, function(data){
  if(data){
    var sent = data.request_ids.split(",").length;
   _gaq.push(["_trackEvent", "Facebook App Request", "Request Sent, sent+" Sent", sent]);
 }
 else{ 
    //cancelled the dialog
 }
});

It returns an object that contains an array, request_ids; each item in the array contains the Facebook ID of the person they invited. (For privacy reasons, you should not send the actual IDs to Google Analytics, but counting them can be useful.)

(For a user that sends 5 app invites, it'll set the label to "5 Sent", and the value to 5. That way, you'll have both the total number of invites sent, as well as the ability to discern the distribution of invite counts sent.)

0

精彩评论

暂无评论...
验证码 换一张
取 消