我有一个 amp 故事,我还使用 Google Analytics 实现了跟踪。诸如故事页面可见之类的事件运行良好。但是,当我尝试在故事页面内的锚标记上跟踪点击事件时,它不起作用。这些是我的触发器和锚标记:
更新代码
<amp-analytics type="gtag" data-credentials="include">
<script type="application/json">
{
"vars": {
"gtag_id": "UA-YYYY-Y",
"event_category": "<%= storyName %>",
"config": {
"UA-YYYY-Y": {
"groups": "default"
}
}
},
"extraUrlParams": {
"cd75": "AMP",
"cd69": "AMP",
"cd81": "marketplace",
"cd76": "${ampdocHostname}"
},
"triggers": {
"linkClick" : {
"on": "click",
"selector": "a",
"request": "event",
"vars": {
"eventCategory" : "click"
}
}
}
}
</script>
</amp-analytics>
<a href="https://amp.dev/" >
<p>click here to read more</p>
</a>
单击锚标记或单击工具提示不会触发任何事件。任何建议都会非常有帮助。