我可以一次跟踪多个 Google Analytics 事件吗? [英] Can I track multiple Google Analytics events at once?

查看:12
本文介绍了我可以一次跟踪多个 Google Analytics 事件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我们的转换表单上使用事件跟踪,将几个下拉菜单的值作为事件传递给 Google Analytics.我们的转换表是我们在线学位课程的查询表.我只想在表单提交时传递字段的值,因此我在成功提交表单时运行的代码中添加了以下代码:

I am using Event Tracking on our conversion form to pass the values of a few drop-downs to Google Analytics as events. Our conversion form is an inquiry form for our online degree programs. I only want to pass the values of the fields on form submit, so I have added the following code to the code that runs on successful submission of the form:

 $("#App,#InquiryForm").validate({    
   submitHandler: function (form) {
 $(".button").attr("value", "Please wait...");
 $(".button").attr("disabled", "disabled");

 _gaq.push(
     ['_trackEvent', 'Inq Form Academic Level', 'Academic Level', $('#AcademicLevel').val()],
     ['_trackEvent', 'Inq Form Delivery Time', 'Delivery Time', $('#CourseDeliveryTime').val()],
     ['_trackEvent', 'Inq Form Program Type', 'Program Type', $('#ProgramType').val()],
     ['_trackEvent', 'Inq Form Program', 'Program', $('#ProgramofInterest').val()]
);

 form.submit();
},

这样做的目的是能够根据他们感兴趣的内容对转化的流量进行细分.(例如,询问我们本科学位的访问者与询问我们研究生学位的访问者的浏览行为是什么).

The purpose of this is to be able to segment our traffic that converted by what they were interested in. (e.g. What was the browsing behavior of visitors who inquired about our undergraduate degrees vs those that inquired about our graduate degrees).

不幸的是,只有第一个事件跟踪脚本成功运行,而不是后三个(无论我放置它们的顺序如何 - 第一个总是唯一成功的).

Unfortunately, only the first event tracking script is running successfully, not the last three (regardless of what order I place them in - the first one is always the only one that is successful).

如果你能帮我完成这项工作,那就太棒了!如果没有,也许有一些替代建议来获取我需要的数据?

If you can help me to get this working, that would be fantastic! If not, perhaps some alternate suggestions to get at the data I need?

谢谢

推荐答案

我测试了一次推送多个事件,效果很好.它可能在所有 _trackEvents 被推送之前提交表单.

I tested pushing multiple events with one push and it worked fine. It may be submitting the form before all the _trackEvents are pushed.

尝试将 setTimeout 添加到 form.submit() 以给 _gaq.push 时间来发送所有这些.>

Try adding a setTimeout to the form.submit() to give the _gaq.push time to send all of them.

setTimeout(function(){ form.submit(); }, 200);

安装 Chrome 和 Google Analytics 调试器.在控制台(control、shift、j)中查看事件跟踪处理.

Install Chrome and the Google Analytics Debugger. Look in the console (control, shift, j) for the event tracking processing.

如果您没有看到所有的事件都在那里跟踪,那么表单值可能有问题.

If you don't see all of your events tracking there, then something is up maybe with the form values.

这篇关于我可以一次跟踪多个 Google Analytics 事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆