Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Track Google Analytics event for all fluent forms in your site
(function($){
if(typeof gtag != 'function') {
return;
}
var fluentForms = $('form.frm-fluent-form');
fluentForms.each(function() {
var $form = $(this);
var formId = $form.attr('data-form_id');
gtag('event', 'ViewForm', {
'event_category': 'FluentForms',
'event_label': 'View Form',
'form_id': formId
});
$form.on('fluentform_submission_success', function() {
gtag('event', 'FormSubmission', {
'event_category': 'FluentForms',
'event_label': 'Form Submitted',
'form_id': formId
});
});
});
}(jQuery));
@Pedroemanuelavelar
Copy link

Pedroemanuelavelar commented Nov 8, 2021

Hello budy, how are you? I come here to ask you permission to use this script on my website. I await the answer!

@Pedroemanuelavelar
Copy link

Pedroemanuelavelar commented Nov 8, 2021

@techjewel
Copy link
Author

techjewel commented Nov 8, 2021

Hi @Pedroemanuelavelar
Please feel free to use any code that is available on my github.

Regards

@Muriendas51
Copy link

Muriendas51 commented Nov 23, 2021

hi @techjewel
Please direct me on how to use this script. I am using Fluent forms on my website.

Kind regards,
Alex M

@gaa23
Copy link

gaa23 commented Jun 15, 2022

Where do we place the Form ID in the google analytics goals?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment