英文:
Google tag manager rest api - trigger creation with filter returns an error
问题
我正在尝试使用Google Tag Manager REST API创建一个新的触发器,并收到以下错误消息:
无法解析触发器数据 com.google.analytics.containertag.common.CtApiaryException: trigger.filter[0].parameter[1]: 过滤器的第二个参数必须为字符串。
这是我的负载:
const body = {
accountId: googleTagManagerAccountId,
containerId: containerId,
workspaceId: workspaceId,
name: `Bla bla PageViews Disabled JS - ${domainUrl}`,
type: 'pageview',
tagFiringOption: 'somePageViews',
filter: [
{
parameter: [
{
type: 'template',
value: '{{ Cheq Essentials Variable }}',
key: 'arg0',
},
{
type: 'boolean',
value: 'false',
key: 'arg1',
},
],
type: 'contains',
},
],
};
有人可以解释一下我的代码有什么问题吗?
谢谢
英文:
I am trying to create a new trigger by using google tag manager rest api and getting this error:
Unable to parse trigger data com.google.analytics.containertag.common.CtApiaryException: trigger.filter[0].parameter[1]: Filter's second argument must be string.
This is my payload:
const body = {
accountId: googleTagManagerAccountId,
containerId: containerId,
workspaceId: workspaceId,
name: `Bla bla PageViews Disabled JS - ${domainUrl}`,
type: 'pageview',
tagFiringOption: 'somePageViews',
filter: [
{
parameter: [
{
type: 'template',
value: '{{ Cheq Essentials Variable }}',
key: 'arg0',
},
{
type: 'boolean',
value: 'false',
key: 'arg1',
},
],
type: 'contains',
},
],
};
can someone explain me please what is wrong with my code?
Thanks
答案1
得分: 0
看起来你正在使用布尔值,而你传递的值是字符串 'false',所以要么你需要更新值,要么参数应该是 'template'。
选项1:在过滤器中更改类型
filter: [
{
parameter: [
{
type: 'template',
value: '{{ Cheq Essentials Variable }}',
key: 'arg0',
},
{
type: 'template',
value: 'false',
key: 'arg1',
},
],
type: 'contains',
},
],
选项2:将值更改为布尔值
filter: [
{
parameter: [
{
type: 'template',
value: '{{ Cheq Essentials Variable }}',
key: 'arg0',
},
{
type: 'boolean',
value: false,
key: 'arg1',
},
],
type: 'contains',
},
],
英文:
seems like you are using boolean and value you are passing is in string 'false' so either you need to update value or the parameter should be 'template'
Option 1 : change type in filter
filter: [
{
parameter: [
{
type: 'template',
value: '{{ Cheq Essentials Variable }}',
key: 'arg0',
},
{
type: 'template',
value: 'false',
key: 'arg1',
},
],
type: 'contains',
},
],
Option 2 : change value as boolean
filter: [
{
parameter: [
{
type: 'template',
value: '{{ Cheq Essentials Variable }}',
key: 'arg0',
},
{
type: 'boolean',
value: false,
key: 'arg1',
},
],
type: 'contains',
},
],
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论