Search code examples
javascriptgoogle-ads-apigoogle-signin

Get Google Ads customer id via login


I use “google-ads-api” to manage google ads. And api needs “customer_account_id” to initialization. However, I Couldn’t found how to get “customer_account_id” programmatically from user.

I used “react-google-login” in front-end, but there is no “customer_account_id” in the response. What is the best way to get customer_account_id?


Solution

  • You'll have to use the CustomerService's ListAccessibleCustomers method. This request does not require a customer_account_id and you can use it to obtain all Google Ads account IDs that the authenticated user has access to. See the documentation for details.

    I believe that in google-ads-api the relevant class is called AccessibleCustomersService.