我们有一个 WordPress 安装,并且每当在 Gravity Forms 中单击表单字段时,我们都会尝试在 Google 分析中进行跟踪。
为此,我们必须在关注该字段时推送 Analytics 变量。这是我们正在使用的代码:-
<script type="text/javascript">
jQuery('#input_1_3').focus(function() {
_gaq.push(['_trackEvent', 'Form Tracking', 'Sidebar Quick Contact Form: Homepage', 'Name']);
});
jQuery('#input_1_4').focus(function() {
_gaq.push(['_trackEvent', 'Form Tracking', 'Sidebar Quick Contact Form: Homepage', 'Company Name']);
});
jQuery('#input_1_5').focus(function() {
_gaq.push(['_trackEvent', 'Form Tracking', 'Sidebar Quick Contact Form: Homepage', 'Email']);
});
jQuery('#input_1_11').focus(function() {
_gaq.push(['_trackEvent', 'Form Tracking', 'Sidebar Quick Contact Form: Homepage', 'Telephone']);
});
jQuery('#input_1_6').focus(function() {
_gaq.push(['_trackEvent', 'Form Tracking', 'Sidebar Quick Contact Form: Homepage', 'Questions/Comments']);
});
输入 ID 与表单中元素的相关 ID 匹配良好,但不会导致 Analytics 中的跟踪。在 WordPress 中似乎与 jQuery 没有任何冲突,并且没有错误导致 Firebug。
您对为什么什么都没有跟踪有任何想法吗?