0
votes

Please can you tell me how to get 7d_view and 28d_click conversion information out of the Facebook marketing API, I only really need the count and amount of sales but I'm struggling to find the values in the response when I do the following in PHP:

$campaign = new Campaign('[CAMPAIGN ID]');

$params = array('date_preset' => InsightsPresets::YESTERDAY, 'action_attribution_windows' => array('7d_view', '28d_click'));
$fields = array('campaign_id', 'campaign_name', 'reach', 'spend','social_spend', 'total_actions', 'total_unique_actions');

$insights = $campaign->getInsights($fields, $params);

foreach ($insights as $ins) {
    var_dump($ins);
}

It executes and returns basic values e.g. Campaign name etc, but it does not seem to include any kind of conversion data.

I suspect I need to add something to the fields array - but I don't know what.

Sorry to ask, but the facebook documentation for the current version of the marketing API (v2.7) says the conversion attribution is deprecated but I can't find what it has been replaced with.

1

1 Answers

1
votes

Sometimes its just a matter of talking to the duck (https://en.wikipedia.org/wiki/Rubber_duck_debugging) - I simply needed to add "actions" to the fields array.