我想跟蹤用戶使用Google Analytics的事件下載文件的頻率,但即使事件似乎已經發送,跟蹤.gif似乎也無法正常到達。爲什麼Google Analytics事件不是從onSubmit發送的?
要下載文件,用戶需填寫簡要表格。輸入此表格的信息通過功能checkSubmit()
(當輸入的信息無效或不完整時返回false
,當信息良好提交時返回true
)檢查。提交後,用戶將重定向到該文件。
<script>
function checkSubmit() {
…
if(dataIsGood) {
_gaq.push(['_trackEvent', 'Download', 'the_filename.xxx']);
return true; //allow the form to submit
} else {
_gaq.push(['_trackEvent', 'Form', 'info not okay']);
return false; //keep the form from being submitted
}
}
</script>
<form action="/form/emailcaptureform" method="post" onSubmit="return checkSubmit();">
… </form>
在Chrome控制檯中,Google Analytics Tracking Debugger說下載事件追蹤信標已經被髮送,但控制檯說,未能加載資源__utm.gif
這種情況僅與事件推在提交表格之前。 活動的工作在我的網站 - 包括表單事件推別處當表單的信息是沒有好(在上面的else
塊)
的Analytics snippet似乎是工作,接受_trackPageview
S和_trackEvent
秒。
__utm.gif的請求URL格式正確:將gadebug輸出中的URL複製並粘貼到位置欄中,並返回__utm.gif。
當從其他元素推送時,事件被推送時沒有問題。例如:
<a href="#" onClick="_gaq.push(['_trackEvent', 'Download', the_filename.xxx']);">Event!</a>
推的情況下,暫停了幾秒鐘,然後返回true
似乎沒有任何效果超越提交表單前添加一個暫停。
您是否有解決方案或建議?
似乎有處理該事件的