0
我在使用Google Goals進行我的事件跟蹤時遇到問題。我甚至將Google代碼添加到我的網頁上。不過,我無法檢查Google Goals中的任何轉化,但事件結果可顯示在Google Analytic - > Behavior - > Events Overview中。Google Analytics事件跟蹤目標
我的代碼如下
` <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);"/>
我的谷歌目標: