WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
[resolved] Google Analytics conversion code (6 posts)

  1. pfaustino
    Member
    Posted 2 years ago #

    I'm trying to implement Google Analytics conversion to my site MarinersPestControl.com. A conversion for us is when a visitor fills out the Contact Forms 7 form and hits the "submit" button.

    When I add the following code, submitting the form no longer works. ie. the rotating graphics starts and stops but there is no "thank you message". Additionally, no email is sent to me with the forms filled in.
    Here is the code that I add to the "Additional Settings" field in the Contact 7 Form editing screen:

    on_sent_ok: "on_gaq.push(['_trackPageview', '/free-termite-inspection-thank-you/']);"

    If I remove that code, the form works again but there is of course no way for google to track the conversion.

    I have read from other posts in this forum that a plugin or my current theme may be breaking the Ajax code that would normally make this work. A solutions presented to turn off all plugins and resort to the default theme is not an option as it could break the site.

    I've also seen some suggestions on using firebug to debug this and this is where I'm at a loss as I'm not sure how to do it. Any suggestions?

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

  2. pfaustino
    Member
    Posted 2 years ago #

  3. pfaustino
    Member
    Posted 2 years ago #

    my apologies... the emails DID go out. It was just sent to my spam box. However, the confirmation box that usually appears at the bottom of the page no longer appears once the form is submitted. Again, it works fine when I remove the "Additional Settings" code above.

  4. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    I couldn't find "on_gaq" object in your page, there is "_gaq" instead. So, maybe correct setting is:

    on_sent_ok: "_gaq.push(['_trackPageview', '/free-termite-inspection-thank-you/']);"

  5. pfaustino
    Member
    Posted 2 years ago #

    ugh. so embarassed right now. thanks Takayuki. I don't know where that extra "on" came from.

  6. camtheman
    Member
    Posted 1 year ago #

    Seems like it's a common problem - mainly relating to Javascript conflicts and usually associated with specific themes.

    After many failed workarounds I moved the GA code into the <head> area of header.php file and that fixed the issue.

    The reason is related to hierarchy of JS calls.

    More excellent info in this thread: http://wordpress.org/support/topic/plugin-contact-form-7-google-analytics-goals-using-the-using-the-_trackpageview-function?replies=26

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic