【问题标题】:How to set Auto-Tagging to true through Google Adwords API如何通过 Google Adwords API 将自动标记设置为 true
【发布时间】:2014-11-13 16:54:39
【问题描述】:

我正在为 Google Adwords v201409 使用 .NET 客户端库。

我可以使用 ManagedCustomer + ManagedCustomerService 创建一个帐户。
问题是 ManagedCustomer 没有我可以设置的自动标记字段。

我尝试使用 ManagedCustomer 创建一个新帐户,获取 CustomerId,并使用 Customer + CustomerService,因为 Customer 有 autoTagging 字段,但这不起作用 (USER_PERMISSION_DENIED)。我假设是因为创建新帐户时生成的 CustomerId 未与具有正确更改数据权限的帐户关联。

那么如何通过 API 创建一个新帐户并将 autoTagging 值设置为 TRUE 或创建一个新帐户然后将其 autoTagging 值更新为 TRUE?

【问题讨论】:

    标签: c# google-ads-api


    【解决方案1】:

    好的。所以我解决了这个问题。

    当我想在新创建的 ManagedCustomer 上更新 autoTagging 时,我会实例化另一个 AdwordsUser 并将其 ClientCustomerId 更改为新创建的 ManagedCustomer customerId。然后我使用 Customer + CustomerService 进行更新。

    我遵循了 Google 提供的代码示例,这就是我实例化 AdwordsUser 的方式:

    AdWordsUser adwordsUser = new AdWordsUser();
    AdWordsAppConfig adwordsConfig = (AdWordsAppConfig)adwordsUser.Config;
    adwordsConfig.ClientCustomerId = 在此处输入客户 ID;

    这样,ClientId/ClientSecret/OAuthToken 用于 API 调用,但 CustomerId 现在是新创建的 ManagedCustomer 的 CustomerId。因此,当我们更改 Customer 的 autoTagging 字段并对其进行更新时,ManagedCustomers autoTagging 值会按照我们的意愿进行更新。

    这是更新自动标记字段的代码:

    private void updateAdwordsCustomer(AdWordsUser adwordsUser)
    {
    CustomerService CustSer = (CustomerService)adwordsUser.GetService(
            AdWordsService.v201409.CustomerService);
    
    
        Customer customer = new Customer();
        customer.autoTaggingEnabled = true;
    
        var s = CustSer.mutate(customer);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-23
      • 2014-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多