通过登录获取 Google Ads 客户 ID

问题描述

我使用“google-ads-api”来管理谷歌广告。并且 api 需要“customer_account_id”来初始化。但是,我找不到如何以编程方式从用户那里获取“customer_account_id”。

我在前端使用了“react-google-login”,但响应中没有“customer_account_id”。获取 customer_account_id 的最佳方法是什么?

解决方法

您必须使用 CustomerServiceListAccessibleCustomers 方法。此请求不需要 customer_account_id,您可以使用它来获取经过身份验证的用户有权访问的所有 Google Ads 帐户 ID。 有关详细信息,请参阅 documentation

我相信在 google-ads-api 中相关的类被称为 AccessibleCustomersService