Can I track multiple Google Analytics events at once?

I use event tracking in the form of conversion to pass the values ​​of several drop-down lists to Google Analytics as events. Our conversion form is a request form for our online programs. I only want to pass the field values ​​in the submit form, so I added the following code to the code that runs when the form is successfully submitted:

$("#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 goal is to be able to segment our traffic, which will be converted depending on what they were interested in. (For example, what was viewing visitors who were interested in our bachelor's degrees compared to those who were interested in our graduate diplomas).

Unfortunately, only the first tracking of script events is successful, and not the last three (no matter in what order I place them - the first of them is always the only successful).

If you can help me get this job, it will be fantastic! If not, maybe some alternative data mining suggestions I need?

thanks

+6
source share
1 answer

I tested the click of several events with one click and it worked fine. It can represent the form before all _trackEvents are clicked.

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

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

Install Chrome and the Google Analytics Debugger . Look at the console (control, shift, j) to handle event tracking.

enter image description here

If you don’t see all your event tracking there, then something happens, possibly with the values ​​of the form.

+6
source

Source: https://habr.com/ru/post/910020/


All Articles