WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] Can't get Google Analytics tracking to work (4 posts)

  1. jodzeee
    Member
    Posted 1 year ago #

    I'm trying to get my conversions to show up in Google Analytics without using a redirect to a thank you page. I've read a lot of posts and from what I understand, adding the following to the Additional Settings area should do the trick:

    on_sent_ok: "_gaq.push(['_trackPageview', '/contact-us/thank-you']);"

    (I have Goals set up in GA for the virtual pages.) The first problem I had was that by adding that, the confirmation message did not appear (nor did the for reset).

    I wrapped the code in a <script> tag and that fixed that problem, but I'm still not seeing anything showing up in Google Analytics.

    I'm using the Yoast Google Analytics plugin.

    What am I doing wrong?

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

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 1 year ago #

    (I have Goals set up in GA for the virtual pages.) The first problem I had was that by adding that, the confirmation message did not appear (nor did the for reset).

    This is probably caused by conflicts with other JavaScript code loaded by other plugins or theme. Check JavaScript errors with Firebug.

    I wrapped the code in a <script> tag and that fixed that problem, but I'm still not seeing anything showing up in Google Analytics.

    Don't use <script> tag. You don't need that and it makes the code unworkable.

    You should check the official instruction (updated recently).

    Tracking Form Submissions with Google Analytics

    If you can share the URL of the site, someone might be able to advice more.

  3. jodzeee
    Member
    Posted 1 year ago #

    The official instruction only talks about events, not page tracking with goals. Is that what was updated? I thought I'd seen the code I provided above on your site, but now it's gone.

    I've removed the <script> tags and the success message seems to be working now.

    I'll leave it be and see if anything shows up in analytics in the next day or two and report back.

    I've actually got three forms and will test three methods. 1) _trackPageview 2) _trackEvent 3) redirect to thank you page

    Hopefully at least one method will work. If not, I'll check for JavaScript errors.

    Thanks for the quick response, I appreciate it!

  4. jodzeee
    Member
    Posted 1 year ago #

    Everything seems to be working now as I thought it should have in the first place using:

    on_sent_ok: "_gaq.push(['_trackPageview', '/contact-us/thank-you']);"

    I have no idea what was going on before, but it seems to be working now.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic