问题描述
我正在编写Google Apps脚本,用于在Google Analytics(分析)中创建受众。我不断收到There was an internal error.
根据[本指南] [1],我可以毫无问题地插入类型为AD_WORDS
的新受众。但是,我当前的任务是复制ANALYTICS
类型的受众。
我提交的资源的linkedAdAccounts
属性似乎不正确。我可以看到官方文档提到了type
的3种可能选项:ADWORDS_LINKS
,DBM_LINKS
,MCC_LINKS
或OPTIMIZE
。不幸的是,除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",},],