Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #167312

    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

    #168294

    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

    #168403

    thank you, it didn’t error out, so I can assume it works.

    #168407

    Hi!

    It should, perform some tests and let us know if it presents any issues :)

    Regards,
    Josue

    #168408

    thanks, will do.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Syntax Error when adding tracking code to form submit button’ is closed to new replies.