Google Analytics event tracking

SupportGoogle Analytics event tracking
lesterhsieh Staff asked 7 years ago
I would like track appointments as events in Google Analytics. Your post on this topic says the new version has ta front-end option to allow for Google Analytics event tracking. How do I set that up?   I don't see an option in settings.  Thank you.
6 Answers
Nikola Loncar Staff answered 7 years ago

Hi,
you are right there is not much in the doc regarding setting Google Analytics. I will improve that part. You will need to add custom JS on the page with EA form. On Appointment creation you will have the call back event so you can track it with GA like this :

<script>
document.addEventListener( 'easyappnewappointment', function( event ) {
    ga('send', 'event', 'New Appointment', 'submit');
}, false );
</script>

Best regards,
Nikola

lesterhsieh Staff replied 7 years ago

Thank you, Nikola — you have created a fantastic product. I will have to figure out where to insert the JS with the theme developer. Thanks again.

lesterhsieh Staff answered 7 years ago
Nikoka, The theme developer could not help me with this.  Can you tell me where I can insert the above script?  Thank you
Nikola Loncar Staff answered 7 years ago
Hi, it's easy to add but I don't know current structure of your theme. You can create a custom page/template and place it only there or you can add it on whole site. Best regards, Nikola
lesterhsieh Staff answered 7 years ago
Ok, I can just insert it under the regular Google Analytics code?  Thank you.
Nikola Loncar Staff answered 7 years ago
Yes, you can. It's just a simple JavaScript. Best regards, Nikola
lesterhsieh Staff answered 7 years ago
Thanks so much for your help!