0

我想在我的 Amp 页面中添加 Facebook Pixels PagesView 和 ViewContent。

这是我的代码:

<amp-analytics type="facebookpixel" id="facebook-pixel">
  <script type="application/json">
    {
      "vars": {
      "pixelId": "xy"
     },
     "triggers": {
       "trackPageview": {
          "on": "visible",
          "request": "pageview"
        },
        "trackViewContent": {
         "on": "visible",
         "request": "eventViewContent",
         "extraUrlParams": {
           "content_category": "open article"
         }
        }
      }
    }
  </script>
</amp-analytics>

Pageview 有效,但对于 ViewContent,我总是在 Facebook Pixel Helper 中收到警告。从 AMP 到 Facebook 的结果 POST 请求是这样的:https://www.facebook.com/tr?noscript=1&ev=ViewContent&id=xy&cd%5Bvalue%5D=&cd%5Bcurrency%5D=&cd%5Bcontent_name%5D=open%20article&cd %5Bcontent_type%5D=&cd%5Bcontent_ids%5D=&dt=o4haxxaf7ij6ugv6b3p7cy2qybh9e8rd

所以它正在向FB发送各种空参数。Facebook 像素的大多数标准事件参数都是可选的。我不希望他们发送所有参数。我只想发送 content_category ..

4

2 回答 2

1

使用 img 像素。例子:

<amp-pixel src="https://www.facebook.com/tr?id=&ev=ViewContent&noscript=1"
    layout="nodisplay"></amp-pixel>
于 2019-01-16T03:29:43.610 回答
0

使用以下配置:

<amp-analytics type="facebookpixel" id="facebook-pixel">
  <script type="application/json">
  {
    "vars": {
      "pixelId": "PIXEL_ID"
    },
    "triggers": {
      "trackPageview": {
        "on": "visible",
        "request": "pageview"
      },
      "trackViewContent": {
        "on": "visible",
        "request": "eventViewContent",
        "vars": {
          "product_catalog_id": "category_id",
          "currency": "EUR",
          "content_name": "content_name",
          "content_category": "content_category",
          "content_type": "product",
          "content_ids": "[1,2,3]",
          "value": "10"
        }
      }
    }
  }
  </script>
</amp-analytics>
于 2019-04-03T10:42:12.590 回答