Site icon Search Engine People Blog

Overcoming Obstacles – How To Use Virtual Pageviews in Google Analytics To Track Conversion

Obstacles to Tracking Conversion in Google Analytics
Tracking conversion is a critical component to understanding how your search marketing campaigns are performing.  Whenever I start helping a new client with web analytics, I map out a thorough strategy so we can easily identify high performing channels, campaigns, and keywords. Unfortunately, I know there are many companies launching a wide range of campaigns without going through this process.  And if you dont effectively track conversion, you run the risk of flying blind.  And flying blind is a dangerous thing to do in online marketing.

In Google Analytics, there are two core ways to track actions that you deem important on your website. First, you can track these actions as conversion goals and then tie conversion back to specific traffic sources, campaigns, or keywords.  You can view conversion goals in Google Analytics via Goal Set tabs in your reporting (see screenshot below).  The second way you can track specific actions on your website is by using Event Tracking.  Using Event Tracking, you can identify when certain actions are triggered on your site, while also providing more information about that event (via parameters you provide in your Event Tracking code).   Which method you choose depends on a number of factors, and you can learn more about tracking conversion goals and events in Google Analytics in a previous post of mine.  Most of the tracking scenarios I develop for clients utilize a combination of conversion goals and events.  For the purposes of this post, Im going to focus on conversion goals.

Also, if you are interested in learning more about developing a web analytics strategy, I cover the process in detail in my internet marketing ebook titled Taking Control of Your Online Marketing.  There is an entire chapter covering how to track your online marketing efforts via Google Analytics.

Obstacles to Tracking Conversion
If you have completed the process of developing an analytics strategy, youll be eager to start tracking conversion.  You probably have identified all of the actions you want to track, whether they are micro or macro-conversions, and how you want to track them via Google Analytics.  But, now you have to go and track them! This is when potential issues could arise.   As you take a hard look at how your site is coded, you might find that there are certain obstacles to tracking conversion.  For example, to track a conversion goal, you need to tell Google Analytics which page visitors will reach to convert.  Thats typically a thank you page after an ecommerce transaction or a form submission.  But what if there isnt a unique destination page that identifies conversion?  This scenario can, and does happen.  Actually, I see this all the time.  🙂

Have No Fear, A Virtual Tracking Solution is Here
The good news is that theres often a way around limitations to tracking conversion.  Some are easy to implement and others are more complex.  Im going to cover an example of overcoming a conversion obstacle that is relatively easy to set up.  The technique listed below can save you from the flying blind scenario I explained earlier and can ensure that each marketing channel is trackable and accountable.  Note, this example uses the traditional Google Analytics snippet and not the new, asynchronous version.  Im using the traditional snippet in this tutorial since I know there are still many marketers who have not transitioned to the asynchronous code yet.  That said, the core concept remains the same.

The Dreaded Form That Posts Back to Itself
This is probably the most common obstacle to tracking conversion that I encounter.  There are times that a form or multistep process is coded in a way that the URL never changes.  For example, you might have a contact form which, once submitted, posts back to the same exact URL (and your developers can catch the form data when posted).  Imagine contact-us.aspx posting back to contact-us.aspx (the same exact URL).

One way around this common obstacle is to trigger a virtual pageview by tagging the html form code.  A virtual pageview is a page that you create (and name), that can be tracked by Google Analytics like any other page thats been triggered.  The page doesnt actually exist, but you can trick Google Analytics into thinking it was viewed.  Then, you can identify this page as the one that Google Analytics should track as the destination URL for a conversion goal.  Subsequently, you would enter the virtual pageview when setting up the conversion goal in Google Analytics.  I explain how to do this later in the post.

Heres how a virtual pageview works:
Someone fills out a form, clicks submit, triggers the virtual pageview, and then the form submission occurs like it normally would.  Google Analytics picks up the page and will report this pageview in your content reporting.  Since its picked up by Google Analytics, you can use the page as the destination URL for a conversion goal.  Awesome.  🙂

How To Add The Virtual Pageview Code:

Original form element:
<form action="contact-us.aspx" method="post">
{form elements here}
</form>

New form element that triggers a virtual pageview:
<form action="contact-us.aspx" method="post" onsubmit="pageTracker._trackPageview('/vpv/contact/');">
{form elements here}
</form>

Important Notes: First, your Google Analytics snippet should be placed ABOVE your form in your html code.  You might have to move the snippet for this page.  Second, be aware that triggering virtual pageviews will artificially inflate your pageview count in Google Analytics.  This is part of the reason I added the /vpv/ subdirectory to the code above.  I can filter out those pages, when needed.

Conversion Goals - Adding The Virtual Pageview
Now that youve coded your form to trigger a virtual pageview, you can use that page as the destination URL when setting up a conversion goal.  Im not going to cover the step by step process of setting up a conversion goal in this post, but Ill show you how to add your newly created page as the destination URL.

While setting up a conversion goal, you have the option of choosing a Destination URL that Google Analytics can track to identify when conversion was triggered.

This is where you can add your newly-created virtual pageview.  For our example, you can choose Head Match as the Match Type and then enter the URL as follows in the field for Goal URL:

/vpv/contact/

Once you save your conversion goal using the virtual pageview, Google Analytics will track conversion when it knows the page has been triggered.  Note, you can also use this technique for other tracking scenarios, like tagging a download, an email link, or any other link on your website.  For those situations, you would want to tag the link and not the form submission.  So, you would trigger the virtual pageview from the onclick event handler of the anchor tag.  Its a handy tactic that can help you track several types of actions on your site.

Finding a Way to Track Conversion
In this post, weve covered a relatively simple way to overcome an obstacle to tracking conversion in Google Analytics.  Unfortunately, there are many scenarios that can inhibit tracking on your website.  But its your job to find a way around those situations!  As mentioned earlier, flying blind is a dangerous thing to do in online marketing.  The good news is that you dont have to.  Map out what you are attempting to measure and then customize your analytics setup, if needed.  If you find a way to effectively track conversion, then you can gain incredible clarity into the performance of your marketing efforts.  Even simple changes can make a huge impact.