I get asked all the time about what I think about Google Analytics. There’s a lot that this analytics tool can do but I wanted to focus on the ga event tracking in this post. Events are a flexible way of capturing data and extending what Google Analytics could do.
This also brings up the question as to how GA compares to tools like Mixpanel and Amplitude which are known to be event-driven. This post will help break apart some of the common Google Analytics concepts.
Let’s get started by looking at it what it means to track pageviews or events and some helpful rules of thumb of when you should them
Pageviews are when a user “views a page on your site that is being tracked by an analytics tool” according to the official definition by Google. If someone views 5 pages on your site, then those are 5 pageviews. If someone views the same page 5 times, then those are also counted as 5 pageviews. Google Analytics also shows you unique pageviews which “aggregates pageviews that are generated by the same user during the same session”.
A session is the amount of a time a user spends on your website or app. They could come to your website and spend 10 minutes browsing around for 1 session of 10 minutes. They could then come back multiple times over the next few weeks and complete separate sessions of different lengths.
When you visit a page on a website, that generates a pageview. The pageview gets sent to your analytics tool alongside a bunch of other information such as:
Your analytics tool then converts all this data into graphs and reports such as the one below:
You can also look at other reports that show you what your most popular pages are and what paths users are taking throughout your site. This is all created from users simply loading your website on their computer. All you have to do is add the analytics snippet to all of your pages and you’ll collect this information without any extra setup work.
In mobile devices, you have the same concept of sessions but pages are called screens and you can get similar information from users as they go through different screens in your app.
Events are also data points that get sent to your analytics tool but they are usually tied to an action that a user takes. This means that events don’t get collected unless you explicitly tell your analytics tool to collect them.
You can use the GA event tracking when users complete actions such as:
Once you send them to your analytics tool, events can also contain the same information as pageviews e.g. location, hardware and browser information. Your analytics will then convert your event data into the same charts and graphs that you saw above.
Now that we know the basic difference between pageviews and events, let’s look at when you should use them.
Some tools like Google Analytics let you track pageviews and events but most tools can usually only capture one of them. Here are some rules of thumb for how to use pageviews and events:
Pageviews are great for:
Events are great for:
The reason why pageviews aren’t well suited for products is that they don’t tell you what is happening within a page. They would simply show that X number of users viewed this page but sometimes you need to know what users are clicking on, where they are getting stuck and how you can improve your design to increase engagement (think products).
On the other hand, events tend to be too complex for tracking marketing activities since you’re mostly interested in where users are coming from (channels) and what pages they are visiting. You’re guiding users to sign up for your product (where you might use an event) but pageviews will give 90% of the information that you need.
Knowing this, you can start to understand why some tools like Google Analytics are better suited for marketing websites while tools like Mixpanel are better suited for products or apps. I seen companies try to set up tools like Mixpanel for tracking websites using the pageview model and it just doesn’t work out very well.
This is how code looks like when sending events to Google Analytics:
This is how the code looks like when sending events to Mixpanel:
This is how the code looks like when sending events to Kissmetrics:
Google Analytics supports a slight variation of pageviews which are called virtual pageviews. These are pageviews that you sent manually to Google Analytics similar to how you would manually send events. However, they are counted as part of the overall number of pageviews within your reports.
Virtual pageviews are used to track special elements like modals and pop ups. When you open a modal, you’re still technically on the same page but you’re viewing a “new page” i.e. the modal. The GA snippet won’t track this properly though so you need to send a virtual pageview when the modal opens and when it closes.
Virtual pageviews (and events) will affect your bounce rate and I will simply link you to this support article for more information. Its minor change to how you need to consider bounce rate for these pages.
If you’re slightly confused about when to use virtual pageviews and when to use events, here is a great rule of thumb by the awesome team at Cardinal Path:
“Use an event on a verb, or an action. Use a VPV (virtual pageview) on a noun, or place.” – Dave Fimek from Cardinal Path
Based on all this, we could hack Google Analytics to do what tools like Mixpanel and Amplitude can offer. This “hacking” means taking Google Analytics to it’s limit and having to export data out of the tool itself.
First, focus on adding events for all the major actions in your product. You only have 3-4 event properties so use them wisely. You could use custom dimensions to add more options but even that is limited to 20 per property.
Second, export your data into Google Sheets or Data Studio. You won’t be able to build all the reports you care about within Google Analytics. GA will simply help you capture the raw data and something like Data Studio can help you visualize it.
Third, add more advanced features like userID and ecommerce tracking to get a complete picture of your product. This will help improve user tracking and add order data alongside you behavioral data.
You’ll notice that this isn’t as “good” as what you could get with event-driven tools. That’s by design, Google Analytics wasn’t built for that. This hacking would be fine for early-stage companies or someone who’s trying to figure out basic product usage.