Search code examples
facebookfacebook-ads-apifacebook-messenger-bot

Facebook Server-side Conversion Tracking


I am wondering if it is possible to track conversions based on the information Facebook provides. (FBID, @facebook.com email)

The only option I see is this

https://developers.facebook.com/docs/marketing-api/app-event-api

And I am still not sure if it would work. If I hashed the @facebook.com email that facebook provides us, would they still be able to associate that with the actual user that clicked the ad?

I am asking this question in relation to facebook message bots. At the moment the only built-in conversion tracking I see is a mutual conversation. I don't see of a way to actually track additional conversions throughout that conversation (for example a successful lead).

Little assistance please :).


Solution

  • Facebook recently added documentation for this

    https://developers.facebook.com/docs/messenger-platform/analytics/quickstart#logging-custom-events

    var request = require('request');
    
    request.post({ 
      url : "https://graph.facebook.com/your-app-id/activities",
      form: {
        event: 'CUSTOM_APP_EVENTS',
        custom_events: JSON.stringify([{
          _eventName: "fb_mobile_purchase",
          _valueToSum: 55.22,
          fb_currency: 'USD'
        }]),
        advertiser_tracking_enabled: 1,
        application_tracking_enabled: 1,
        extinfo: JSON.stringify(['mb1']),
        page_id: your-page-id,
        page_scoped_user_id: recipientId
      }
    }, function(err,httpResponse,body){ 
      console.error(err);
      console.log(httpResponse.statusCode);
      console.log(body);
    });
    

    This would allow you to track a custom event, and then use that custom event ad a conversion.