如何在 GA4 中获取自定义事件
How to get custom events in GA4
我的网站是静态页面。
使用这个 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>
在管理员下,我关闭了增强测量设置“文件下载”以允许我的自定义事件。
使用此事件处理程序:
<a href="./special.pdf" onclick="ga('send', 'event', 'cw-downloads', 'cw-download-pdf', 'special.pdf',);">Print this page </a>
但是在 analytics.google.com 我的自定义事件没有显示。实时和第二天的报告。
您可以使用以下语法:
gtag('event', 'login', {
'method': 'Google'
});
https://developers.google.com/analytics/devguides/collection/ga4/events
我的网站是静态页面。
使用这个 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>
在管理员下,我关闭了增强测量设置“文件下载”以允许我的自定义事件。
使用此事件处理程序:
<a href="./special.pdf" onclick="ga('send', 'event', 'cw-downloads', 'cw-download-pdf', 'special.pdf',);">Print this page </a>
但是在 analytics.google.com 我的自定义事件没有显示。实时和第二天的报告。
您可以使用以下语法:
gtag('event', 'login', {
'method': 'Google'
});
https://developers.google.com/analytics/devguides/collection/ga4/events