WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
How to add google analytics conversion tracking on contact form 7 (12 posts)

  1. gangemipasquale
    Member
    Posted 2 years ago #

    Hi, i would like to know how to add javascript code from google analytics to track conversion every time that someone click to submit button. Thank you ;)

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

  2. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

  3. gangemipasquale
    Member
    Posted 2 years ago #

    thank you, i've committed an error, i meant google adwords conversions, sorry and thank you for the answer.

  4. citydan
    Member
    Posted 2 years ago #

    I also need to know how to make Google ADWORDS conversion tracking work with Contact Form 7.
    I understand that you can call javascript functions with the on_sent_ok parameter in the Contact Form admin settings.

    What I need are step-by-step instructions:
    1. where do I put the conversion tracking code provided by Google Adwords? This is 20 lines of code.
    Can I somehow put this into the on_sent_ok field? If not, how to do it?

  5. thebadone411
    Member
    Posted 2 years ago #

    @Takayuki

    I've read that page but I think it was written before Google Analytics started using their asynchronus code.

    Does the code to set this up change if I'm using asynchronus analytics code on my site?

    Thanks

  6. Takayuki Miyoshi
    Member
    Plugin Author

    Posted 2 years ago #

    Tracking Form Submissions with Google Analytics

    Note: If you use newer version of the tracking code, you need to run this code instead:

    _gaq.push(['_trackPageview', '/mysite/thank-you.html']);

  7. thebadone411
    Member
    Posted 2 years ago #

    So nothing about on_sent_ok ?

  8. savarez
    Member
    Posted 2 years ago #

    I would like to know solution for this also!
    on_sent_ok:"_gaq.push(['_trackPageview', '/mysite/thank-you.html']);" did not work.

    Is it with or without on_sent_ok: ?

  9. AWB Collier
    Member
    Posted 2 years ago #

    I would also like to know how to add the javascript code for conversion tracking on google adwords.

    Can we enter more than one line of Java after the on_sent_ok tag?

    For example, setting up one conversion with Ad Words requires entering the following Java into the 'thank you' page:

    <!-- Google Code for Availability Enquiry Conversion Page -->
    <script type="text/javascript">
    /* <![CDATA[ */
    var google_conversion_id = 1066013591;
    var google_conversion_language = "en";
    var google_conversion_format = "3";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "AwLUCPGitAIQl6eo_AM";
    var google_conversion_value = 0;
    /* ]]> */
    </script>
    <script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
    </script>
    <noscript>
    <div style="display:inline;">
    <img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1066013591/?label=AwLUCPGitAIQl6eo_AM&guid=ON&script=0"/>
    </div>
    </noscript>

    How can I enter all this code into Conactform7?

  10. danisei
    Member
    Posted 2 years ago #

    hi, will it work to use commerce code, if we create an .html with the commerce code? i mean that all the code posted by puddy127 would be put into some file like "/mysite/thank-you.html" and while using the query "_gaq.push(['_trackPageview', '/mysite/thank-you.html']);" the wanted commerce form will be run?

  11. czb1972
    Member
    Posted 2 years ago #

  12. yivi
    Member
    Posted 2 years ago #

    You don't need to do that.

    If what you want is a redirect, just using:
    on_sent_ok: "location = 'http://example.com/';"

    (as explained here)

    If what you need is just tracking of conversions for Analytics, use this.

    And if what you need is tracking AdWords conversions, set up the conversion variables as globals with a "<script>" tag in the conversion page, and call the conversion code from on_sent_ok (e.g., using jQuery)

    In the body/header of your conversion page:

    <script type="text/javascript">
    var google_conversion_id = <Your ID Here>;
    var google_conversion_language = "en";
    var google_conversion_format = "3";
    var google_conversion_color = "ffffff";
    var google_conversion_label = "<Your Label here>";
    var google_conversion_value = 0;
    </script>

    And in the bottom part of Contact Form 7 settings:

    on_sent_ok: $jQuery.getScript( "http://www.googleadservices.com/pagead/conversion.js" );

    I think this should work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic