PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Place Google Analytics conversion tracking script on each form's thank you

  1. mmorris

    I manage a website for a client who also has an AdWords campaign, and we need to set up conversion tracking for each form submitted. The company that is managing the AdWords campaign has set up the conversion tracking script for me to place on each "thank you" page that appears after a form is submitted (we have six AdWords groups; each group leads to a page on the site where a form can be submitted), but I don't know how to add the GA script.

    The company told me that the script needs to go in the head section of each "thank you" page, except that we don't have a thank you page; instead, when someone completes the form a little thank-you message pops up—you don't actually leave the page and go to a separate thank you page.

    Is there a way for me to place the javascript snippet somewhere in each form so that when the submit button is hit it tracks in GA?

    (As an example, here is one of the forms:

    Posted 9 years ago on Wednesday March 9, 2011 | Permalink
  2. You can try placing the code in the Thank You message confirmation text for your form. It should still get executed.

    You can also create a custom thank you page and use the redirect feature to redirect to that rather than the built in confirmation text.

    Posted 9 years ago on Wednesday March 9, 2011 | Permalink
  3. mmorris

    Excellent, thank you so much!

    Posted 9 years ago on Wednesday March 9, 2011 | Permalink
  4. mmorris

    Hi again,

    I placed the script in the confirmation box as indicated, but when the form is submitted the source code shows that it's converted into HTML, which
    tags placed after each line of javascript. The ad company we're working with has indicated that this will cause the script to not work correctly.

    Do you know if there's any way to get the form to not convert javascript to HTML? Or is my only other option to create a new thank you page and direct the form submission to it?


    Posted 9 years ago on Friday March 11, 2011 | Permalink
  5. We'll look into this, the issue may be because the Confirmation Text block auto-formats your content. We may have to add a feature to the Confirmation Text like we have on Notification Text to not auto-format. I will look into this.

    A work around is to use a custom thank you page. Create a page in WordPress that acts as your thank you page and use that as your confirmation page. Then setup your form to redirect to that page as the Thank You message.

    But i'll look into the confirmation text/html issue as it relates to Javascript.

    Posted 9 years ago on Friday March 11, 2011 | Permalink
  6. mmorris

    Thanks so much, Carl. I'll create a custom thank-you page as a work around but look forward to the ability to not have the text auto-formatted right in the confirmation box. That would be awesome! :)

    Posted 9 years ago on Friday March 11, 2011 | Permalink
  7. deukdesign


    Posted 9 years ago on Wednesday March 30, 2011 | Permalink
  8. 1.5 allows you to disable auto-formatting on the confirmation text. So this should be doable in the 1.5 release if you disable auto-formatting when configuring your confirmation message.

    Posted 9 years ago on Wednesday March 30, 2011 | Permalink
  9. Hi,
    How do I add Google Analytics code to have a virtual conversion using this structure:

    on_sent_ok: "_gaq.push(['_trackPageview', '/sidebar-contact-form-confirmation/']);"

    Posted 8 years ago on Friday April 15, 2011 | Permalink
  10. Huh! I missed that sooo much! Thank you, this really helps. The workaround with the other tahnk-you page is not so nice, since you can't place fields there.

    Posted 8 years ago on Tuesday October 11, 2011 | Permalink
  11. Google Analytics conversion goal code should be able to be executed using a jQuery script block in the confirmation message of the form.

    You would edit your form, edit the form settings and select the Confirmation tab. Then you would need to place the script related to conversion in the confirmation message itself. It would then be executed when the confirmation message is displayed.

    See this screenshot:

    If you aren't sure how to execute that Google Analytics code using a script block, this tutorial explains how to do it:

    When placing scripts like this in the confirmation message you must disable auto-formatting on the confirmation message. Otherwise the auto-formatting can cause problems with the script itself.

    Posted 8 years ago on Monday February 13, 2012 | Permalink

This topic has been resolved and has been closed to new replies.