• Resolved pingram

    (@pingram3541)


    I need to track click events on my web forms.

    I setup a hidden tracking button in the html after my form which gets triggered when the form is submitted successfully.

    <div class="contact-tracking"><a href="#" onclick="_gaq.push(['_trackEvent', 'Webform', 'Submit', 'Homepage']);"></a></div>

    I then simulate a click on it w/ js in the forms success action, which works.

    $(“.contact-tracking a”).click();

    The following error results:

    Uncaught ReferenceError: _gaq is not defined

    Reading a bit on this error apprently you have to define this _gaq array in the script. How do I do this with NK? I can see I can provide a custom script but not sure the point of using NK vs just adding the script directly to my html in this case.

    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-65432-1']);
    _gaq.push(['_trackPageview']);

    https://www.ads-software.com/plugins/nk-google-analytics/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author justanotherdev

    (@marodok)

    Hi,

    The “_gaq” is part of Classic Analytics, have you selected this option in the plugin settings?

    Regards

    Thread Starter pingram

    (@pingram3541)

    Thanks. I actually figured out I can removed the added html and simply add the following js to my form success and the default NK setup by simply supplying the account id works just fine now.

    ga('send', 'event', 'form', 'submit', {'page': '/contact-us'});

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘conversion tracking on click events’ is closed to new replies.