In our last video, we went over how to set up conversion funnels in Google Analytics. Today, we continue and cover how to set up virtual pageviews. Virtual pageviews allow you to track:
- Button, image and link clicks.
- Video stops, pauses or volume changes.
- How much of a video has been watched.
- File downloads and basically any action a user can take on a webpage.
First we will simply go over how virtual pageviews work. Then we’ll move on and show you how to insert virtual pageview tracking into event handler code, so that you can learn how to do it on your own website.
- How to Set Up Conversion Funnels in Google Analytics
- The Google Analytics Conversion Funnel Survival Guide
Bryan: Hi, I’m Bryan with KISSmetrics, and I’m here to help you get the most out of your Google Analytics account.
Last week, we talked about sales funnels.
Today, I’m going to show you a cool trick that allows you to track and analyze how your users interact with the forms that are embedded on your website. First, I’ll introduce you to the concept of virtual page views, and then we’ll cover how to integrate these with conversion tracking funnels to give you greater insights into your site. So, let’s get going.
First, let’s talk about virtual page views. We all know how normal page view tracking works. First, you install the big, nasty block of code at the bottom of every page on your site, and then anytime a visitor comes to your site, that block of code recognizes it and registers that person as being a visitor on your site.
So, when you go to the back end of your Google Analytics reports, you can see how many visitors have come to your site. Virtual page views work exactly the same way, except with virtual page views you’re able to track anything that a user does on your site instead of just the fact that they visited the site at all.
So, let’s consider two examples to see what that looks like in real life. Suppose that you have a video embedded on your website. Normal page view tracking will tell you if a visitor has seen the page with the video, but it won’t tell you how many times the user has pressed the play button, the pause button, changed the volume, or how much of the video they have actually watched. All it will tell you is that a visitor has seen the page.
With virtual page views, we can change that. We can track each one of those things. We can know how many times they’ve played, how many times they’ve paused, the changing of the volume button, and the duration of the time that they have watched the video.
Or suppose that you have a file download on your site. The normal steps to download would be for a visitor to come to the page and then click a link or a button that automatically starts downloading that file. With normal page view tracking, the act of a user downloading the file would go untracked. However, we can track every instance of a user downloading a file as a page view with virtual page view tracking.
Those are the basics of how virtual page views operate. Now, let’s look at how to install them and set them up on your own website.
It’s actually fairly simple. Just like installing the main Google Analytics code, we’re going to take a predefined block of code and put it in each instance that we want to track. Now all you have to do is copy and paste it into whatever event handler that you want to use to initiate the page view.
So, if you want to track the play button, simply paste this code into the event handler that controls the play button, and every time a user clicks the play button it will be registered as a page view in your Google Analytics account.
You will need to modify this section of the code. This parameter gives the virtual page view a name, and this will be the name of the page that is reported in your page view tracking report.
All right, let’s do a quick recap. Now we know what virtual page views are. We know how to set ’em up and install them on our website. Now let’s look specifically at how to set them up inside of a form and then tie that form to a conversion tracking funnel so we can see where we can improve.
We’re going to start by looking at a basic form. To install virtual page view tracking into a form field, we’ll include the parameter onBlur=. onBlur is an event handler that is called when a visitor clicks the mouse or enters a keystroke outside of this field.
Next, we’ll look at the second section of this code. This part simply states that if the form field is not empty, then do whatever comes next. So, if the user has entered any data into this specific form field, then do the next part, but if he hasn’t, don’t do anything at all.
And then lastly, we’re going to paste in our virtual page view code that we looked at earlier and give this specific form field a name. Calling the trackPageView function with the corresponding field name generates a virtual page view for the completion of that field.
So, if somebody enters a value in there and then goes to the next section or clicks off of that section, as soon as they do that, that code sends a note to Google and says, “Hey, that was a page view. Count it as a page view,” and then you can see that page view in your Google Analytics reporting.
You don’t have to submit the form. All you have to do is fill out the form field, and then take the focus off of that form field, and this code registers that as a page view. Now, we’re simply going to do this for each field in the entire form [pause] and we’re all set up.
Now that all of our tracking code is installed, we can set up a conversion funnel to give us an easy to use report for how our users are interacting with the form. To do this, we’ll first go to Admin. Then we’ll select the property and profile for the site that we’re working on.
Next, choose Goals underneath the profile column. And now select Create a Goal, and then we will enter the name we want to use to refer to this funnel. For our purposes, we’ll call it the Contact Us funnel. We’ll now choose destination as the type and press Next Step.
The destination field will be the page name that we gave to our submit button. Since our submit button is the last item in this form, we want to track it as the goal. In our case, we named it “submit button,” so we’ll enter that here. Next, turn the funnel option to On. And now we’ll enter the URL for each field in our form in the order that they appear in the form. Then, lastly, press Create Goal, and we’re all done.
All right, that’s it! We’re all finished. We now know what virtual page views are, we’ve seen how to install them and set them up on our website, and we also know how to tie them to conversion funnels to track the interaction with forms on our website.
If you want to see the in depth reporting on your funnel, simply go to the funnel visualization report in the reporting section of your Google Analytic account. That’s it for this week. Happy virtual page viewing.
See How My Agency Can Drive More Traffic to Your Website
- SEO - unlock more SEO traffic. See real results.
- Content Marketing - our team creates epic content that will get shared, get links, and attract traffic.
- Paid Media - effective paid strategies with clear ROI.
Are You Using Google Ads? Try Our FREE Ads Grader!
Stop wasting money and unlock the hidden potential of your advertising.
- Discover the power of intentional advertising.
- Reach your ideal target audience.
- Maximize ad spend efficiency.