Google Ads API PHP example Getcampaign: what exactly is the customer ID?

729 views
Skip to first unread message

Ihadavision

unread,
Dec 20, 2022, 3:45:04 AM12/20/22
to Google Ads API and AdWords API Forum
So we setup everything and even successfully requested access to a test google ads account for which we got an "access token" and we're trying to test this sample "getcampaign" call from the github:

But it asks for a CUSTOMER_ID = 'INSERT_CUSTOMER_ID_HERE';
We have a "client" id, a secret, a dev token, even an "access_token" from an account we connected to through oauth, but no "customer ID" that I know of. Or is it the 10-digit account ID of the account we wanna get campaigns from? But still, nowhere in that code does it tell us where to put our access_token or anything that proves we have access to that account? Or are we missing a step?

Been trying to watch videos but they are for ruby or python. We're developing in PHP.

Thanks for any help.

* Yes, we're beginners, sorry.

Google Ads API Forum Advisor

unread,
Dec 20, 2022, 5:46:05 AM12/20/22
to wunli...@gmail.com, adwor...@googlegroups.com

Hi, 

Thanks for reaching out to the Google Ads API Forum. I hope you are doing well today.

We are glad to help you with your concern.

“Is it the 10-digit account ID of the account we wanna get campaigns from?”

>> yes you are correct. The client customer ID is the account number of the Google Ads client account you want to manage with the API, usually in the form 123-456-7890.

Kindly note that the PHP client library takes care of access_token and we don't need to generate it. Note that following example is to generate refresh token which is required for the API request as mention in this guide: https://developers.google.com/google-ads/api/samples/generate-user-credentials.

class GetCampaigns
{
private const CUSTOMER_ID = '1234567890';
 public static function main()
 {

I hope it helps. Let me know if you have further questions. Have a great day.

Regards,

Google Logo
Marjorie
Google Ads API Team
 


ref:_00D1U1174p._5004Q2hLoyu:ref
Reply all
Reply to author
Forward
0 new messages