[英]How to get custom events in GA4
My website is static pages.我的网站是 static 页面。
Using this gtag.js:使用这个 gtag.js:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-measurementid"></script>
<script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-measurementid'); </script>
Under Admin I turned off the Enhanced Measurement setting "File Downloads" to allow for my custom event.在管理员下,我关闭了增强测量设置“文件下载”以允许我的自定义事件。
Using this event handler:使用此事件处理程序:
<a href="./special.pdf" onclick="ga('send', 'event', 'cw-downloads', 'cw-download-pdf', 'special.pdf',);">Print this page </a>
But at analytics.google.com my custom event doesn't show.但是在analytics.google.com 我的自定义事件没有显示。 Both Realtime and in next day's report.
实时报告和次日报告。
You can use this syntax:您可以使用以下语法:
gtag('event', 'login', {
'method': 'Google'
});
https://developers.google.com/analytics/devguides/collection/ga4/events https://developers.google.com/analytics/devguides/collection/ga4/events
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.