We love digital

Call 0845 485 1219

We love digital - Call and say hello - Mon - Fri, 9am - 5pm

How To Track Contact Form Submissions Without A Confirmation Page

Anna Lewis

by Anna Lewis on 9th August 2011

SubmitSometimes web developers are unable to create a thank you or confirmation page for a form submission, this leaves you unable to easily track how many forms have been completed, as goals in Google Analytics require a URL. However, there is a nice and easy way round this. It just takes a small amount of code and you can create a pretend URL to load when the submit button is pressed.

This is done by using the Virtual Pageview method which, as you might have guessed, enables you to track a page that doesn’t actually exist. It will then appear in your content report and you can create a goal with this URL destination. An alternative would be to use Event tracking, however if you wanted this page created by web developers there is no harm in using Virtual Pageviews. If you didn’t want to have a Virtual Pageview in your content report you can always use Event tracking, details of how to do this can be found in my post about tracking clicks on a link in Google Analytics.

Here’s the code used in a typical form submission button, the second one here has the Virtual Pageview tracking code in:

<input name=”submit” type=”submit” id=”Submit” value=”Submit Form”/>

<input name=”submit” type=”submit” id=”Submit” value=”Submit Form” onClick=”_gaq.push(['_trackPageview', '/form/submit']);”/>

So the area to customise is:

onClick=”_gaq.push(['_trackPageview', '/form/submit']);”

You can choose what you would like the URL to be, if you have more than one form you can name each one differently.

Once you have chosen your virtual URL and added the code within the button, the final step is to create a goal in Google Anlaytics to measure this.

Image Source

Web Submit Button via BigStock

Anna Lewis

Anna Lewis

Our resident analytics specialist is Anna Lewis. Anna is unbelievably attuned to anything analytical and can fill you in on all the latest news, tips and advice to get ahead in this evolving market.

down arrow

Your Free Whitepaper

The Practical Guide To Google Analytics For Businesses (2nd Edition)

The Practical Guide To Google Analytics For Businesses (2nd Edition)

Download this whitepaper now and get a new one every month!

Download »

3 Comments

  • Rick V 19th December 2011

    Thanks for the tips! can you confrim if this still works with analytics new asynchronous tracking, or will this need to be modified to call javascript when setting trackPageview?

    example:
    onClick=”javascript: pageTracker._trackPageview(‘/form/submit’)”>

    Thanks

    Reply to this comment

    • Anna Lewis

      Anna 19th December 2011

      Hi Rick, the code above is for the new asynch version, you can spot the difference by looking for the push function which is not used in the traditional code. Shout if you have any problems getting it working and would like a hand.

      Reply to this comment

  • Alex 11th December 2012

    this solution will not guarantee that _all_ of the form submissions are tracked, as the submit event triggers a POST before the event request to GA is received by them. i´ve tried a number of ways to accomplish that by hand and realized that it is impossible.
    i ended up using a vendor, RevRise for this problem which seems to work fine for now (although in beta).

    Reply to this comment

Subscribe To The Koozai Blog