Google Analytics API - RemarketingAudiences.insert 仅在 linkedAdAccounts 为 AD_WORDS 时有效

Google Analytics API - RemarketingAudiences.insert only working when linkedAdAccounts is AD_WORDS

我正在编写 Google Apps 脚本,用于在 Google Analytics 中创建受众。我不断收到非常无用的错误消息 There was an internal error.

根据[本指南][1],我可以毫无问题地插入类型为 AD_WORDS 的新受众。但是,我当前的任务涉及复制 ANALYTICS.

类型的受众

看来我提交的资源的linkedAdAccounts属性不正确。我可以看到官方文档提到了 type 的 3 个可能选项:ADWORDS_LINKSDBM_LINKSMCC_LINKSOPTIMIZE。不幸的是,除了 ADWORDS_LINKS.

之外,没有给出这些如何工作的详细解释。

这是被拒绝的负载:

{
    name: "newName",
    linkedViews: ["123445677"],
    linkedAdAccounts: [
      {
        kind: "analytics#linkedForeignAccount",
        internalWebPropertyId: "12345678",
        status: "OPEN",
        remarketingAudienceId: "aaaaaaaaaaaaaaaaaaaaa",
        id: "xxxxxxxxxxxxxxxxxxxxx",
        webPropertyId: "UA-1234567-1",
        type: "ANALYTICS",
        accountId: "12345678",
      },
    ],
    audienceType: "SIMPLE",
    audienceDefinition: {
      includeConditions: {
        daysToLookBack: 7,
        segment: "users::condition::ga:sessionDuration>60",
        membershipDurationDays: 30,
        isSmartList: false,
      },
    },
  }

事实证明,您无法为 ANALYTICS linkedAdAccount 添加 ID。只需添加以下内容即可。

linkedAdAccounts: [
      {
        type: "ANALYTICS",
      },
    ],