如何解决从ga迁移到gtag.js脚本
在https://developers.google.com/gtagjs/reference上找不到直接迁移教程或清晰的描述。 限制对门户网站的分析,无法对其进行适当的测试。
需要将我的SPA应用程序中的下一个ga脚本更改为gtag。
1. ga('set','page',url)
2. ga('send','pageview')
3. ga('send','event','button-interest-request','submit-request')
我没有找到应如何在gtag上进行设置。
我认为应该是字符串1和2的下一个字符串
gtag('event','page_view',{ page_location: url })
接下来是字符串3
gtag('event',{
'value': 'submit-request'
});
我说得对吗?
解决方法
您必须使用以下语法在event category
中至少定义event action
和gtag
:
gtag('event',<action>,{
'event_category': <category>,'value': <value>
});
在您的情况下,像这样:
gtag('event','submit-request',{
'event_category': 'button-interest-request'
});
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。