0

I am using a Wordpress plugin to create a form and unfortunately the plugin doesn't allow to add onClick code and I would like to use Google Event Tracking to perform analytics on the form. What Javascript would I need to be able to add this:

onClick="_trackEvent ('Home', 'ButtonClick', 'Submit')"

To my form button? The ID of the form button is ninja_forms_field_10

Thank you!

1

1 Answer 1

1

It would need to be something like this (using jQuery since it is built in to Wordpress by default):

$('#ninja_forms_field_10').click(function() { _trackEvent('Home','ButtonClick','Submit'); });

Since you need to pass parameters to the function you need to call, you have to wrap it in another function which will then call it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.