In this documentation, We will use google analytics universal gtag. So make sure you are using gtag.js to your site.
How to Add Custom JavaScript to Your WordPress Site
Another source: Universal Analytics (gtag.js)
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','#pafe-form-builder-trigger-success-YOUR-FORM-ID',function(){
gtag('event', 'PAFE Form Builder Submission', {
'event_category': 'PAFE Form Builder',
'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-pafe-form-builder-trigger-success]',function(){
gtag('event', 'PAFE Form Builder Submission', {
'event_category': 'PAFE Form Builder',
'event_label': 'Form Submitted',
});
});
});
</script>