hborras / twitter-php-ads-sdk

A Twitter supported and maintained Ads API SDK for PHP.
55 stars 41 forks source link

How to report on active campaigns only #92

Open dfuse-dev opened 3 years ago

dfuse-dev commented 3 years ago

Hi,

Loving this one! It is very helpful to get authentication done for those of us with basic knowledge on APIs. Just would like to know what would be the best approach to get:

1.- Active accounts (those with impressions delivered the last 3 days) 2.- For those active accounts, all campaigns with delivery for the last 3 days 3.- For those active campaigns, get the report with daily breakdown for the last 3 days with given dimmensions and metrics

Thank you in advance,

eblucas commented 3 years ago

Hi @hborras ,

I have the same question. How can we do that?

This is how am I'm doing now- $campaigns = $account->getCampaigns('', [TwitterAds\Fields\CampaignFields::COUNT => 10]);-

But I couldn't find any documentation about getting only active campaigns and line items.

Thanks

eblucas commented 3 years ago

hi @hborras , do you have any tips on how to do this?

Thanks

hborras commented 3 years ago

Hello! As far as I know, this is not possible. I usually only get stats for Active campaings and control in my backend when a campaign is paused or reach its end date

Sorry!

dfuse-dev commented 3 years ago

This could be done by requesting

$activeTweets = $api->get('stats/accounts/'.$accountID.'/active_entities', $paramsActive);

https://developer.twitter.com/en/docs/twitter-ads-api/analytics/guides/active-entities