Open SamuelDeanA opened 3 years ago
Hi @SamuelCompary Good find! I will take a look at this and see how we can update the package.
Here is the upgrade guide we'll need to follow on the migration to the new API details. If you find a faster way to implement these changes let me know and we can do some pull requests. Hopefully, it's only fixing a few auth issues and the package updates on the googleads lib change the endpoints. I'm currently busy on a project, so unable to look into this upgrade just yet, but feel free if it looks like it might be easy.
I'm trying to get this working. It's way above my skill level but I'm trying and have some feedback after a few tries.
What I've done so far:
In composer.json update: "googleads/googleads-php-lib": "^49.0",
to "googleads/googleads-php-lib": "^54.0",
Next on my Laravel project I connected to laravel-ads-sdk
using dev-master
and added this to repositories:
{
"type": "path",
"url": "../laravel-ads-sdk"
}
Next I could do composer update. At that point I just tried this in tinker but as you will see still same API versioning issue:
✗ art tinker;
Psy Shell v0.10.9 (PHP 8.0.12 — cli) by Justin Hileman
>>> $googleAds = LaravelAds::googleAds()->with('XXX-XXX-XXXX');
=> LaravelAds\Services\GoogleAds\Service {#4417}
>>> $campaigns = $googleAds->fetch()->getCampaigns();
[2021-11-09T21:07:04.315379+02:00] AW_SOAP.WARNING: clientCustomerId=XXX-XXX-XXXX operations=1 service=CampaignService method=get responseTime=127 requestId=0005d05fd09dfce00a37c919240185b4 server=adwords.google.com isFault=1 faultMessage=[QuotaCheckError.INVALID_TOKEN_HEADER @ ; trigger:'New developers must use the Google Ads API: https://developers.google.com/google-ads/api/docs/start']
So I went back to the "upgrade guide" but then noted that:
To see what I mean, check the below screenshot. Two PHP libraries, and the one seems to "standing still" in terms of updates.
At this point I though, okay, let me remove googleads-php-lib
and try google-ads-php
. That seemed fairly logical.
However, now there is a new error:
✗ art tinker;
Psy Shell v0.10.9 (PHP 8.0.12 — cli) by Justin Hileman
>>> $googleAds = LaravelAds::googleAds()->with('XXX-XXX-XXXX');
=> LaravelAds\Services\GoogleAds\Service {#4417}
>>> $campaigns = $googleAds->fetch()->getCampaigns();
PHP Error: Class "Google\AdsApi\AdWords\v201809\cm\Selector" not found in /home/eugene/code/laravel-ads-sdk/src/Services/GoogleAds/Fetch.php on line 46
I see this code is in src/Services/GoogleAds/Fetch.php
Am I correct in assuming all of this must be migrated to the new API? Like where do I even start?
Am I even on the right track?
Any other tips to move this forward? I'm dying to use this API with Laravel and would hate to revert to a vanilla library. I need generics when analyzing ad accounts which is exactly what this library gives me.
Not sure if this is of help? There is a Laravel sample app:
https://github.com/googleads/googleads-php-lib/tree/master/examples/AdWords/LaravelSampleApp
Edit:
I also couldn't get the Laravel App working and tried to log an issue...
Then after battling on for another few hours I came to the conclusion because I've recently registered as a Google API user I won't be able to use the old library. So the idea of implementing the new library is sound, as least for new users.
The next major issue is I can't even get their examples working. It seems the new PHP library is a big departure from the old one, much more complex. For example, the code below is the example getCampaigns()
:
https://github.com/googleads/google-ads-php/blob/main/examples/BasicOperations/GetCampaigns.php
The problem is this "improved" getCampaings uses streaming and GRPC and although it's possible to install on Linux it's not easy at all. Also to me at this point it seems the new Google Ads PHP API is a dramatic departure from the old one and a lot of code will have to be rewritten, I guess, to work using streams. For my limited time budget, this is unfortunately a dead end but I would love to hear feedback from other users.
I've actually written a fluent query builder for GQL, to use with the Google ADS Api, for reporting anyway. I'm not sure it fits into the existing framework you have setup, but I'd be willing to share!
@zacksmash That would be pretty cool. More tools the better!
As for an update to this issue, I will be making an update to get this API back to work on new users have reported. Sorry for the delay.
Thanks, @smaddy, I know this has been on here for a little while, I created a new ticket regarding this upgrade. #52, Has anyone had any luck testing out the new API? If not I will look into the migration, but given my availability, was hoping someone else has been able to do so.
Hi,
I'm currently trying to use this package with newly generated Google Ads credentials. And when running
LaravelAds::googleAds()->with($accountNumber)->reports($startDate, $endDate)->getAccountReport();
an exception occurs with the messageDetails: [fieldPath: ; trigger: New developers must use the Google Ads API: https://developers.google.com/google-ads/api/docs/start; errorString: QuotaCheckError.INVALID_TOKEN_HEADER]
. It seems like newly created credentials must use their new API.Are there any plans to make this package use their new API so we that recently created our API credentials can actually use the Google Ads part of this package?