首页 文章

如何获取adwords帐户客户端ID以将其链接到MCC帐户?

提问于
浏览
4

我想在我的网络应用程序上通过Google Adwords API向您的MCC帐户添加Adwords帐户 . 我想我只需要添加ManagedCustomerLink

问题是我不知道如何获得clientCustomerId . 我想通过在我的应用程序上使用匹配范围通过OAuth2验证用户,我可以以某种方式得到他们的clientCustomerId但我找不到它 .

提前感谢您的帮助!

3 回答

  • 0

    您可以通过运行下一个代码来获取客户端客户ID:

    CustomerServiceInterface customerService = adWordsServices.get(session, CustomerServiceInterface.class);
    Customer[] customers;
    try {
        customers = customerService.getCustomers();
        for (Customer customer : customers) {
            Long customerId = customer.getCustomerId();
            System.out.println(customerId);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    

    为了获得用户会话,您必须使用Oauth 2.0并询问他的凭据 .

  • 1

    基于阅读上述George Astonishing的交流,我想知道您是否真的想要将AdWords帐户添加到MCC .

    AdWords帐户所有者之间存在差异

    • 授权您的应用访问其数据,vs

    • 成为贵公司的客户,进行全面的AdWords管理 .

    如果此AdWords帐户属于您公司的客户,并且您正在接管其帐户管理,则可以使用ManagedCustomerService将该帐户添加到您的MCC . 您可以使用CustomerService获取该帐户的10位AdWords客户ID .

    另一方面,如果这是针对Web应用程序,并且您只希望用户能够使用OAuth2进行授权,那么您应该遵循this guide .

  • 0

    在这里,访问此Google Adwords图书馆的链接,

    https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/v201509/AccountManagement/GetAccountHierarchy.php

    创建新用户后

    $user = new AdWordsUser(); // with your API creds using OAUTH       
       GetAccountHierarchyExample(AdWordsUser $user)  //found in link
    

    只需运行该功能 . 它将列出您的所有托管子帐户 .

相关问题