facebook - AMP 页面中的 Facebookpixel ViewContent
问题描述
我想在我的 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 ..
解决方案
使用 img 像素。例子:
<amp-pixel src="https://www.facebook.com/tr?id=&ev=ViewContent&noscript=1"
layout="nodisplay"></amp-pixel>
推荐阅读
- r - 在 tmap 中指定大小图例的填充颜色
- android - Android设备上的Axios帖子给我网络错误
- javascript - 用 Sequalize 重命名 belongsToMany 关联
- python - 如何检查文件是否存在并在文件丢失时创建一个,而文件的路径不完整,如下所示
- azure - 使用 ARM 订阅级别部署部署多个资源时出现问题
- python - 我们可以在 OAuth2Session 过期前 x 秒刷新令牌吗?
- microsoft-graph-api - 使用图形 API 来自组 azure AD 的用户/成员计数
- ruby-on-rails - 从 Docker 导出 RSpec 测试
- javascript - Tampermonkey 脚本未能修改表单控件
- html - 带有 CSS 的圆形复选标记角。可能吗?