jamesbester
Forum Replies Created
-
Forum: Plugins
In reply to: [VS Contact Form] Adding Google Analytics Tracking CodeExcellent, that worked fantastically, thank you! 🙂
Forum: Plugins
In reply to: [VS Contact Form] Adding Google Analytics Tracking CodeHi Guidi,
It’s to track an event goal in Google Analytics. So when people click on the submit button, it sends a ‘signal’ through to Google Analytics so we can see that someone has submitted a form.
I didn’t know you could redirect it to another URL when you submit the form, so that might help, so I’ll look into that as well.
James
Forum: Plugins
In reply to: [VS Contact Form] Adding Google Analytics Tracking CodeHi,
The code I put in on the vscf-form.php file was:
<button type=”submit” name=”vscf_send” id=”vscf_send” class=”btn btn-primary”>’.esc_attr($vscf_atts[‘label_submit’]).’ .onClick=”ga(‘send’, ‘event’, { eventCategory: ‘Contact Us’, eventAction: ‘Send’});”</button>
I’m not really great at PHP, but from what I could see that was the piece of code that generates the button itself, so by putting the onClick code within it would hopefully make it work.
I guess I could try wrapping it around the button in <script> tags if you think that’d work? I’m hesitant to try making too many changes too often as the site is live and the client is using it.
James