Google Analytics Event Tracking
In this documentation, We will use google analytics universal gtag. So make sure you are using gtag.js to your site.
https://developers.google.com/analytics/devguides/collection/gtagjs/events#send_events
Option 1: Track per form basis
Add the following code to your site. You have to change YOUR-FORM-ID by your Form Id and you can change the event_category or event_label value based on your needs.
<script>
jQuery(document).ready(function($) {
$(document).on('click','#piotnetforms-trigger-success-YOUR-FORM-ID',function(){
gtag('event', 'Piotnet Forms Submission', {
'event_category': 'Piotnet Forms',
'event_label': 'Form Submitted',
'form_id': 'YOUR-FORM-ID'
});
});
});
</script>
Option 2: Track Events For All Forms
Add the following code to your site. You can change the event_category or event_label value based on your needs.
<script>
jQuery(document).ready(function($) {
$(document).on('click','[data-piotnetforms-trigger-success]',function(){
gtag('event', 'Piotnet Forms Submission', {
'event_category': 'Piotnet Forms',
'event_label': 'Form Submitted',
});
});
});
</script>