WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
on_sent_ok hook working but _gaq.push tracking isn't (4 posts)

  1. MarbleCake
    Member
    Posted 1 year ago #

    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', 'http://www.websitename.com/contact/request-a-prospectus/sent.html']);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', 'http://www.websitename.com/contact/request-a-prospectus/sent.html']);alert('Sent!');"

    Still nothing.

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

    http://wordpress.org/extend/plugins/contact-form-7/

  2. MarbleCake
    Member
    Posted 1 year ago #

    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!

  3. screenbeetle
    Member
    Posted 10 months ago #

    Hello 'MarbleCake'

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

    Ta

  4. Martina Oswald
    Member
    Posted 9 months ago #

    hey!

    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: http://www.searchingsam.com/wordpress-tracking-contact-form-7-conversions-in-google-analytics/#.Ul-Xg1C-18H

    Tested with:
    WP v3.6.1
    CF7 v3.5.3

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic