Support » Plugin: Contact Form 7 » on_sent_ok hook working but _gaq.push tracking isn't

  • Hi there

    Firstly, thanks for a great plugin. I have been using it for ages and it keeps getting better and better.

    Sadly, I have come upon an issue in the latest version (or maybe the latest version of WordPress). The site in questions is WPv3.5.1 and CF7v3.3.3

    My client complained that the GA tracking we had set up had stopped working. I went in and checked the settings but it all looked fine:

    on_sent_ok: "_gaq.push(['_trackPageview', '/contact/request-a-prospectus/sent.html']);"

    I tried setting the URL to a fully qualified URL but that still doesn’t work.

    So then I tried the following to check the hook is working:

    on_sent_ok: "alert('Sent!');"

    Sure enough, upon submission of the form, a nice little dialogue box appeared with the word “Sent!” in.

    So then I tried the following:

    on_sent_ok: "_gaq.push(['_trackPageview', '']);alert('Sent!');"

    Again, the dialogue popped up so I assume the _gaq.push has also been executed. However, there are still no tracking hits coming through.

    I then tried this:

    on_sent_ok: "_gaq.push(['_setAccount', 'UA-XXXXXXX-1']);_gaq.push(['_trackPageview', '']);alert('Sent!');"

    Still nothing.

    Do you have any idea as to what could be happening (or not) here? It’s driving me nuts!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Oh, I should also say that this has stopped working on a site with the following set up too: WPv3.4.2 and CF7v3.2.1

    Oh, and obviously I have changed the site URL and GA ID in the above examples!

    And also, I should say that of course, _setAccount has already been declared in the GA script at the end of the <head> on the page. I was clutching at straws when I declared it again on that last attempt!

    Hello ‘MarbleCake’

    Did you ever get this issue working again by the way?



    I don’t know if help is still needed but if someone is looking for a solution this is what I did:
    on_sent_ok: "_gaq.push(['_trackEvent', 'Form', 'Form-Submission']);"

    Instead of tracking a Pageview it’s now an Event, so you should adjust your Google Analytics Settings:

    Tested with:
    WP v3.6.1
    CF7 v3.5.3

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘on_sent_ok hook working but _gaq.push tracking isn't’ is closed to new replies.