Reputation: 17
I've been trying to pull out the spend of each ad campaign using the Meta Insights API, but the spend comes out as the currency as stated in the account_currency field.
When creating a report through Ads Reporting in Ads Manager, there's an option to 'Standardise Currency' and select USD, so all the 'Amount Spent' is shown as USD.
Is there a way that I could get the spend from the API all in USD as well?
Upvotes: 0
Views: 604
Reputation: 146
Their documentation says its available. https://developers.facebook.com/docs/graph-api/reference/currency/
usd_exchange
The exchange rate between the person's preferred currency and US Dollars
I had the same issue as I had multiple ad accounts of different currency. To convert the currency to USD, I created a Currency Converter function from any currency to USD.
//Currency Convert to USD
function ConvertUSD($amount, $from)
{
$response_json = file_get_contents("https://api.exchangerate-api.com/v4/latest/" . $from);
$response_object = json_decode($response_json);
$usd = round(($amount * $response_object->rates->USD), 2);
return $usd;
}
$from = $ad_account["currency"]; //GBP
$amount = 100;
//Call the function where you need USD value
ConvertUSD($amount,$from);
List of Supported countries https://www.exchangerate-api.com/docs/supported-currencies
Upvotes: 0