Tracking Facebook Referrals
Because of how Facebook proxies the request for your Campaign, referrer information is lost. That means you can’t just add Google Analytics tracking code to your Campaign and expect to see where traffic comes from. However, it is possible to track your advertising Campaigns using a special parameter supported by Facebook.
For example, let’s say we want to add two parameters, campaign and ad_id to a Campaign URL. Normally, the link would look like this:
As already noted, though, Facebook will ignore those extra parameters and the the extra parameters will never reach the Campaign. It may also make sense to do this:
However, the above won’t work either because = and & have a special meaning in URLs, so the data won’t come through intact. To fix this, encode the value for app_data like this:
The example code below will show two values in your browser's console: the campaign and ad_id values placed in the "campaign=" and "ad_id=" parameters of the Campaign URL. Please be aware that the example code below should only be used for testing and verification.
Using the app_data parameters
- Add the parameters to outgoing links (for example, links to your website) so that actions which take place on your website can be credited to the originating ads.
- Create and insert a one-pixel, dynamic tracking image URL.
- Using the Google Analytics API and add the parameters to track the page view.