edbizarro / laravel-facebook-ads

Facebook & Instagram Ads API for Laravel
MIT License
122 stars 32 forks source link

Question: How to get all campaigns for an account #16

Closed maxchirkov closed 6 years ago

maxchirkov commented 7 years ago

Hi there,

I'd like to get a summary for all campaigns on all of my accounts that I manage.

As I understand, I need to get adAccounts()->all() first, then loop through them and call $insights->get('campaign', $account['id'], $params);. But I always get account data rather than campaigns. I have a feeling that I need to pass campaign ID instead of account ID... but there's no way to get all campaigns and find out their IDs.

So, how would I go about getting insights summary for all active campaigns on each account?

Thank you!

edbizarro commented 7 years ago

hi @maxchirkov

Unfortunately right now there is no way to get all campaigns, but I'm planning to implement this functionality this weekend

I'll let you know as soon as i send it

edbizarro commented 7 years ago

Hi @maxchirkov, today i pushed some changes and craft a new release (v0.8.1) with campaigns enabled

https://github.com/edbizarro/laravel-facebook-ads#campaign

maxchirkov commented 7 years ago

Hi Ed,

I can't seem to update to the latest version via composer, since there's a minimum-stability conflict with roave/security-advisories[dev-master] package. Your minimum-stability is configured to stable while you're referring to dev-master package. I think that might be the issue.

edbizarro commented 7 years ago

You're right, a new release 0.8.2 already be avaliable with the fix

Thx!

edbizarro commented 7 years ago

@maxchirkov i'm working on v1.0.0 at the time, some methods will be their signatures changed, all() and the services, there will be breaking change, but the package public API will be much more easy to use.

i'm planning to lunch the 1.0.0 in march

maxchirkov commented 7 years ago

Thanks, Eduardo!

I'm in an exploratory mode right now. Trying to see if I can ease the pain of overseeing dozens of accounts at once. We are running similar campaigns for our clients all across the states. While audiences are different, the goals are the same. I need something that would allow me to build an overview report across all accounts/campaigns and quickly identify the once that need immediate attention.

I have a somewhat unrelated question: Facebook developer account limits the number of advertisement accounts that I can work with to 5. It says that the app needs to be published first, in order to increase the limit.. I'd like to have this as an in-house tool - I'm not looking into releasing a public app. Do you know if it's possible? And if so, how would I achieve it?

Thank you!

Max Chirkov

On Tue, Feb 21, 2017 at 5:20 AM, Eduardo Bizarro notifications@github.com wrote:

@maxchirkov https://github.com/maxchirkov i'm working on v1.0.0 at time, some methods will be their signatures changed, all() and the services. will be breaking change, but the public API will be much more easy to use.

i'm planning to lunch the 1.0.0 in march

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/edbizarro/laravel-facebook-ads/issues/16#issuecomment-281329826, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1_eJWQ970yDjUFQM-SbTOlAo9LYzuiks5retZ8gaJpZM4L8fZX .

maxchirkov commented 7 years ago

According to your docs, I can call $adsApi->campaigns(), but I'm getting an error: Call to undefined method Edbizarro\LaravelFacebookAds\FacebookAds::campaigns()

Looking at your code, it seems like I should be doing $adsApi->adAccounts()->campaings(), which actually works, but it requires Account ID for $campaings->all($fields, $accountId). Which means I have to loop through all accounts and call $campaigns->all() for each account.

Seems like, logically, if I get all accounts, and call get all campaigns on all accounts, it should do just that. Also, each Account should probably have its own campaign getter, so it could be like:

foreach ($adAccounts as $account)
{
    $account->campaings()->all(); // without the need to specify the ad account.
}

Just a food for thought.

edbizarro commented 7 years ago

hi @maxchirkov

Your facebook APP can be private (not listed) but must be in LIVE mode, in other words you need to submit to facebook app review.

Yeah, i'll update the docs, thanks for the tips, the code in the current state is a little confusing, i know, that's why i'm working on the stable 1.0 release.

Khalid12345678 commented 6 years ago

Before using it, it's necessary to initialize the library with an valid access token, php example. I am not getting above point please describe this point "How to initialize the library with valid access token".I got access app token from Graph Explorer.

edbizarro commented 6 years ago

Hi @Khalid12345678 sry, in the docs i missed this step

Just call FacebookAds::init($accessToken); and you're good to go

Khalid12345678 commented 6 years ago

Thank you so much

On Tue, 11 Sep 2018 at 10:54, Eduardo Bizarro notifications@github.com wrote:

Closed #16 https://github.com/edbizarro/laravel-facebook-ads/issues/16.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/edbizarro/laravel-facebook-ads/issues/16#event-1837623943, or mute the thread https://github.com/notifications/unsubscribe-auth/AiAzxkgHn32fTEmHMXI1ESZFfYche47_ks5uZ0kbgaJpZM4L8fZX .

mohamedhussieen commented 2 years ago

may any one put example to get all my campaigns to my laravel project