Track one ajax form submission to several emails in Google Analytics -
i have ajax form submits several emails based on boxes checked. able track in google analytics companies form email sent - not form submission.
i have figured out how track form submission following code based on success:
success: function(response) { if (response.status == 'success') { $('#formcont').html(''); } $('#output').html(response.errmessage); $('#gaq').html(function(){_gaq.push(['_trackevent', 'booking - quote request', response.gaq ]);}); }
i have tried track multiple events following code using while statement no success. new jquery may incorrect appreciated.
response.gaq2 array of company names.
success: function(response) { if (response.status == 'success') { $('#formcont').html(''); } $('#output').html(response.errmessage); $('#gaq2').html(function(){ var companyarray = response.gaq2, = companyarray.length; while(i--) { _gaq.push(['_trackevent', '2booking - quote request', + companyarray[i]]); } }); }
solution - figured out doing wrong.
success: function(response) { if (response.status == 'success') { var companyarray = response.gaq2.split(","), = companyarray.length; while(i--) { _gaq.push(['_trackevent', '2booking - quote request', companyarray[i]]); } $('#formcont').html(''); } $('#output').html(response.errmessage); }
Comments
Post a Comment