Google 目标的分析事件跟踪
Google Analytics Event tracking for Goals
我在为我的事件跟踪使用 Google 目标时遇到问题。我已将 Google 甚至跟踪代码添加到我的网页。但是,我无法检查 Google 目标中的任何转化,但事件结果可以显示在 Google 分析 --> 行为 --> 事件概述中。
我的代码在下面
` <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-87810245-1', 'auto');
ga('send', 'pageview');
</script>
<script>
$('#contact-form').on('submit', function(event) {
// Prevent the browser's default form submission action.
event.preventDefault();
ga('send', 'event', {
eventCategory: 'Contact',
eventAction: 'Information Request',
eventLabel: 'Contact Form',
hitCallback: function() {
$('contact-form').trigger('submit');
}
});
});
</script>`
我的提交按钮代码:
<input type="submit" id="submit" value="Validate and Submit" onclick="ga('send', 'event', 'form', 'submit', 'order sent', 10);"/>
我的 Google 目标:
enter image description here
Google 分析事件概述:
所以您有两个事件正在进行,一个是点击提交按钮(也许是为了跟踪意图),另一个是表单提交本身。您的目标配置为期望值 Greater than
10,但您的表单提交事件未传入值。您应该添加一个值(大于 10),或从目标配置中删除该值。此外,您的屏幕截图可能只显示了点击事件(因为与之关联的值为 10),但您可能对实际提交本身更感兴趣。
我在为我的事件跟踪使用 Google 目标时遇到问题。我已将 Google 甚至跟踪代码添加到我的网页。但是,我无法检查 Google 目标中的任何转化,但事件结果可以显示在 Google 分析 --> 行为 --> 事件概述中。
我的代码在下面
` <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-87810245-1', 'auto');
ga('send', 'pageview');
</script>
<script>
$('#contact-form').on('submit', function(event) {
// Prevent the browser's default form submission action.
event.preventDefault();
ga('send', 'event', {
eventCategory: 'Contact',
eventAction: 'Information Request',
eventLabel: 'Contact Form',
hitCallback: function() {
$('contact-form').trigger('submit');
}
});
});
</script>`
我的提交按钮代码:
<input type="submit" id="submit" value="Validate and Submit" onclick="ga('send', 'event', 'form', 'submit', 'order sent', 10);"/>
我的 Google 目标:
enter image description here
Google 分析事件概述:
所以您有两个事件正在进行,一个是点击提交按钮(也许是为了跟踪意图),另一个是表单提交本身。您的目标配置为期望值 Greater than
10,但您的表单提交事件未传入值。您应该添加一个值(大于 10),或从目标配置中删除该值。此外,您的屏幕截图可能只显示了点击事件(因为与之关联的值为 10),但您可能对实际提交本身更感兴趣。