GTM API错误 vendorTemplate.parameter.eventName: 值不得为空。

huangapple go评论56阅读模式
英文:

GTM API error vendorTemplate.parameter.eventName: The value must not be empty.\n

问题

我正试图在页面https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/containers/workspaces/tags/create中添加一个新的标签到GTM。

在父级中,我使用了以下值:
accounts/[123456789]/containers/[1234567]/workspaces/[1234567]。

* - 在 [] 中的值,例如。

在请求体中,我写入了以下数据:

{
    "name": "Test",
    "type": "gaawc"
}

每次我都会收到以下错误:

{"error": {
      "code": 400,
      "message": "vendorTemplate.parameter.measurementId: The value must not be empty.\n",
      "errors": [{
          "message": "vendorTemplate.parameter.measurementId: The value must not be empty.\n",
          "domain": "global",
          "reason": "badRequest"
      }],
      "status": "INVALID_ARGUMENT"
}}

GTM API错误 vendorTemplate.parameter.eventName: 值不得为空。

英文:

I am trying to add a new tag to GTM on the page https://developers.google.com/tag-platform/tag-manager/api/v2/reference/accounts/containers/workspaces/tags/create.

In parent I use next value:
accounts/[123456789]/containers/[1234567]/workspaces/[1234567].

* - in [] value for example.

In request body I write next data:

{
    "name": "Test",
    "type": "gaawc"
}

All time I getting the next error:

{"error": {
      "code": 400,
      "message": "vendorTemplate.parameter.measurementId: The value must not be empty.\n",
      "errors": [{
          "message": "vendorTemplate.parameter.measurementId: The value must not be empty.\n",
          "domain": "global",
          "reason": "badRequest"
      }],
      "status": "INVALID_ARGUMENT"
}}

GTM API错误 vendorTemplate.parameter.eventName: 值不得为空。

答案1

得分: 0

这是因为您正在使用 gaawc 标签类型。

因此,负载中有一些必需的字段。

在这种情况下,您不能只发送 name : "test"

您需要指定 measurementId


返回GTM UI并尝试创建一个GA4配置标签。如果您不设置测量ID,您将无法保存它。因此,如果要使用API创建标签,则规则是相同的。


如果您不确定负载应该是什么。

简单的方法是在GTM UI中创建 tag

然后将其导出为JSON文件。您将看到标签的实际JSON。

这是一个测试GA4配置标签的示例

{
    "accountId": "3853417116",
    "containerId": "9675477",
    "tagId": "6",
    "name": "test-ga4-config-tag",
    "type": "gaawc",
    "parameter": [
        {
            "type": "BOOLEAN",
            "key": "sendPageView",
            "value": "true"
        },
        {
            "type": "BOOLEAN",
            "key": "enableSendToServerContainer",
            "value": "false"
        },
        {
            "type": "TEMPLATE",
            "key": "measurementId",
            "value": "G-000000"
        }
    ],
    "fingerprint": "1691569014795",
    "firingTriggerId": [
        "2147479553"
    ],
    "tagFiringOption": "ONCE_PER_EVENT",
    "monitoringMetadata": {
        "type": "MAP"
    },
    "consentSettings": {
        "consentStatus": "NOT_SET"
    }
}
英文:

This is because you are using gaawc tag type.

So there are some several required field in the payload.

You can not just send name : "test" in this case.

You need to specify the measurementId.


Go back to GTM UI and try to create a GA4 configuration tag. You can not save it without setting the measurement id. So the rule is same if you want to use the API to create tag.


If you are not sure what the payload should be.

The simple way is create the tag in the GTM UI.

And export it as json file. You will see the actual json for the tag.

here is an example for test GA4 config tag

{
    "accountId": "3853417116",
    "containerId": "9675477",
    "tagId": "6",
    "name": "test-ga4-config-tag",
    "type": "gaawc",
    "parameter": [
        {
            "type": "BOOLEAN",
            "key": "sendPageView",
            "value": "true"
        },
        {
            "type": "BOOLEAN",
            "key": "enableSendToServerContainer",
            "value": "false"
        },
        {
            "type": "TEMPLATE",
            "key": "measurementId",
            "value": "G-000000"
        }
    ],
    "fingerprint": "1691569014795",
    "firingTriggerId": [
        "2147479553"
    ],
    "tagFiringOption": "ONCE_PER_EVENT",
    "monitoringMetadata": {
        "type": "MAP"
    },
    "consentSettings": {
        "consentStatus": "NOT_SET"
    }
}

huangapple
  • 本文由 发表于 2023年8月9日 15:37:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/76865567-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定