Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #429580

    I know, I know, there is a FAQ: http://kriesi.at/documentation/enfold/add-onclick-event-to-the-contact-form-submit-button/

    But the problem is – it doesn’t work. I put in child theme’s functions.php this code:

    add_filter('avf_contact_form_submit_button_attr','avia_add_submit_attributes_to_cf', 10, 3);
    function avia_add_submit_attributes_to_cf($att, $formID, $form_params){
    $att = "onclick=\" dataLayer.push({'event': 'form-submission'}); \"";
    return $att;
    }

    and it doesn’t push anything to data layer.

    At the same time, I created a standalone html file in the root of my site, and put there this code

    <a href="#" name="button1" onclick="dataLayer.push({'event': 'form-submission'});" >Button 1</a>

    and it does work.

    • This topic was modified 9 years, 8 months ago by Vermishelle.
    #430379

    Hi Vermishelle!

    I’m not sure if we will be able to help with your tracking but send us a link to your page and we’ll check your source code to see if the onclick attribute is being set properly.

    Best regards,
    Elliott

    #430635

    Sorry for disturbing, now it works.

    #431094

    Hi!

    Great, glad you got it fixed.

    Regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘tracking contact form in google tag manager’ is closed to new replies.