Tagged: devin-docs, form, google analytics, submit, Tracking Code
I was trying to add the suggested code to the form button,
$this->output .= '<input type="submit" onClick="_gaq.push(['_trackEvent', 'Contact', 'Form Submission', 'Contact Page Form',, false]);" value="'.$this->form_params['submit'].'" class="button" />';
as suggested here: https://kriesi.at/support/topic/adding-event-tracking-to-choices-contact-form/#post-121376
And got the following error:
Parse error: syntax error, unexpected ‘_trackEvent’ (T_STRING) in /home/maasen/public_html/wp-content/themes/enfold/framework/php/class-form-generator.php on line 179
Hi paulsutton!
It’s a quote issue, try with this code instead:
$this->output .= '<input type="submit" onClick="_gaq.push([\'_trackEvent\', \'Contact\', \'Form Submission\', \'Contact Page Form\',, false]);" value="'.$this->form_params['submit'].'" class="button" />';
Regards,
Josue
thank you, it didn’t error out, so I can assume it works.
Hi!
It should, perform some tests and let us know if it presents any issues :)
Regards,
Josue
thanks, will do.