Google Analytics Event Tracking Tutorial
This post is a guide on ‘event tracking’ feature in Google Analytics and is an attempt to explain ‘Event Tracking and Virtual PageViews from A to Z in an easy to understand language. So here we go.
- The Basics
- Generating virtual pageviews
- Best practices for creating virtual pageviews
- Setting up Event Tracking in Google Analytics
- Advantage of using Event Tracking over Virtual pageviews
- Best practices for setting up event tracking
- Event Tracking Reports
The Basics
The first thing that you need to understand is the meaning of ‘event’ from Google Analytics perspective. Event is a user’s interaction /activity with a webpage element like flash videos, gadgets, images, links etc. An event can be:
- Downloading a file
- Loading of Ajax, JavaScript or flash contents
- Loading of a dynamically generated webpage
- Loading of pop-ups, light boxes
- Loading of a flash video or a webpage
- Scrolling down the page
- Viewing of a flash video
- Viewing video footage of certain length
- Clicking on a video’s play/pause/stop button
- Interaction with a gadget
- Clicking on an image or a link
- Abandonment of a form
- Log-ins
- Sharing/printing a blog post, article, video or image
There are two types of events in Google Analytics:
- One which generate pageviews when they occur like clicking on an internal link on a webpage. In this case Google Analytics calls the _trackPageView() method each time such event occurs.
- One which doesn’t generate pageviews when they occur like: clicking on an external link, loading of Ajax/Flash content, downloading a file, viewing of a video, clicking on a video’s play button etc. In this case Google Analytics doesn’t call the _trackPageView() method each time such event occurs.
By default Google Analytics (GA) can’t track any event which doesn’t generate pageview when it occurs like: clicking on an external link, viewing of a flash video, downloading a file etc. You can track such events through virtual pageviews or event tracking. An event in event tracking reports of GA is made up of: category, action, label and numerical value. We will discuss them in detail later. Now lets start with virtual pageviews. It is a pageview which GA tracks even when no new page has actually been loaded into the browser.
Generating virtual pageviews
You can generate virtual pageviews by calling _trackPageView() method each time the event you want to track occurs.
Syntax: _gaq.push ([‘_trackPageView’,’name of your virtual page’]);
Examples:
<a href=”http://www.abc.com/gu/dw/seo-beginners-guide.pdf” onClick=”_gaq.push ([‘_trackPageView’,’/virtual/guides/download/seo-beginners-guide.pdf’]);”> Download SEO Beginners Guide</a>
<a href=”http://www.abc.com/gu/dw/social-media-guide.pdf” onClick=”_gaq.push ([‘_trackPageView’,’/virtual/guides/download/social-media-guide.pdf’]);”> Download Social Media Guide</a>
You can call _trackPageView() method using a JavaScript handler like onClick, onSubmit etc. You can create a virtual page view wherever you can call a JavaScript method. You should track those types of events using virtual pageviews which are equivalent of a page being viewed like: downloading a file, loading of Ajax, JavaScript or flash contents, loading of a dynamically generated webpage, loading of pop-ups, light boxes, scrolling down a page or when you want to track an event as a goal.
You can see virtual pageviews in ‘Top Content’ and ‘Content Drilldown’ reports in GA along with real page views. However note that ‘virtual page views’ are not highlighted as ‘virtual’ in the reports and you may have to use filter on the reporting interface to find them. One disadvantage of using virtual page views is that it can artificially inflate your overall page views. So the question is how you can distinguish virtual pageviews from real pageviews in GA reports. To do this start your virtual page name by ‘virtual’ and then search for ‘virtual’ using filter on the reporting interface. In this way you can easily spot virtual pageviews in GA report. For e.g.
_gaq.push ([‘_trackPageView’,’/virtual/guides/download/seo-beginners-guide.pdf]);

Searching for Virtual Pages in Google Analytics reports
Note: GA also calls the trackPageView() method in GATC (Google Analytics Tracking Code) each time a page is loaded by the browser. This method is called immediately after the _setAccount() method in GATC:
_gaq.push ([‘_setAccount’,’UA-12345-1’]);
_gaq.push ([‘_trackPageView’]);
Best practices for creating virtual pageviews
- Use clear and consistent naming conventions for your virtual pages.
- Start your virtual page name with the word ‘virtual’ so that you can easily spot them in the GA report.
- Create one or more virtual directories to categories your webpage elements. For e.g.
_gaq.push ([‘_trackPageView’,’virtual/guides/downloads/seo-beginners-guide.pdf]);
- Create duplicate profiles which filter out virtual pageviews.
Setting up Event Tracking in Google Analytics
You can set up event tracking in GA by calling _trackEvent() method each time the event you want to track occurs. This method is used to record/track an event.
Syntax:
_gaq.push ([‘_trackEvent’,’event category’,’event action’,’event label’, event value]);
Event Category => It is the name given to group of similar events which you want to track. For e.g. ‘videos’
Event Action => It is the name given to the type of event you want to track for a particular webpage element. For e.g. ‘play’, ‘stop’, ‘pause’, ‘share’ etc.
Event Label => It is used to provide additional information about the webpage element you want to track like: title of a video, name of a gadget, name of the downloadable file etc.
Event Value => It is the numerical value assigned to the event you want to track. For e.g. download time, length of the video footage played or some dollar value.
Note: Specifying ‘event category’ and ‘event action’ in _trackEvent() method is mandatory. Whereas specifying ‘event label’ and ‘event value’ in _trackEvent() method is optional.
Examples:
<a href=”http://www.abc.com/gu/dw/seo-beginners-guide.pdf” onClick=”_gaq.push ([‘_trackEvent’,’guides’,’download-seo’,’seo-beginners-guide.pdf’,10]);”>Download SEO Beginners Guide</a>
<a href=”http://www.abc.com/gu/dw/social-media-guide.pdf” onClick=”_gaq.push ([‘_trackEvent’,’guides’,’download-social’,’social-media-guide.pdf’,10]);”>Download Social Media Guide</a>
There is a disadvantage of using duplicate ‘event action’ names across categories. The disadvantage is that unique events are incremented by unique action names. So if a user clicks on two different videos say ‘spiderman-2’ and ‘Aliens vs predator’ which have same action name say ‘play’, then in that case GA will report only one unique event even when the user clicked on two different videos. So action names should be unique. For e.g.
_gaq.push ([‘_trackEvent’,’videos’, ‘play-spiderman’,’Spiderman-2’,10]);
_gaq.push ([‘_trackEvent’,’videos’, ‘play-dog-out’,’Who lets the dog out’,10]);
_gaq.push ([‘_trackEvent’,’videos’, ‘play-aliens-predator’,’Alien vs predator’,10]);
You can call _trackEvent() method using a JavaScript handler like onClick, onSubmit etc. You can record an event wherever you can call a JavaScript method. You should track those type of events using ‘event tracking’ which are not equivalent of a page being viewed like: viewing of a flash video, viewing video footage of certain length, clicking on a video’s play/pause/stop button, interaction with a gadget, clicking on an image or a link, abandonment of a form, log-ins, sharing/printing a blog post, article, video or image etc. You decide the reporting structure through arguments of _trackEvent() method. You should avoid tracking highly repetitive events like mouse movements because GA can’t track more than 500 events per visit.
Advantage of using Event Tracking over Virtual pageviews
- Event tracking doesn’t artificially inflate your overall pageviews.
- Through event tracking reports available in GA you can analyze events in much greater details. For e.g. you can not only see how many times people watched your video but also what was the effect of video viewing on your site usage and e-commerce metrics.
Best practices for setting up event tracking
- Use clear and consistent naming conventions for event categories, event actions and event labels.
- Determine in advance all of the web page elements (like videos, gadget, image, external link etc) and type of events you want to track.
- Create a hierarchy of event categories, event actions and event labels that is scalable.Then work with your report users to make sure that your hierarchy is understandable.
Event Tracking Reports

The Event tracking reports are available under the ‘content’ report in Google Analytics. There are 4 event tracking reports available in Google Analytics:
- Event Tracking Overview report
- Event Tracking Top Events report
- Event Tracking Pages report
- Event Tracking Events Flow report
Event Tracking Overview report - This report provides overview of tracked events on your website like:
- Total events
- Unique events
- Event Value
- Avg. Value
- Visits with event
- Events/visit
- Top events
Total events => It is the total number of users’ interaction with tracked webpage elements. It is also the total number of times the _trackEvent() method was called. For e.g. if a visitor clicks on the ‘play’ button of a same video 5 times, then GA report Total events as 5 but unique events (number of unique interactions that occurred in a web session) as 1.
Event Value => It is the total value of an event or set of events.
Avg. Value => It is the average value of an event.
Visits with event => These are those web sessions in which at least one tracked event occurs.
Events/visit => It is the number of tracked events that occurred in a web session.
Top Events => It includes top event categories, top event actions and top event labels. You can find these metrics in Top events reports too.
Event Categories report - Through this report you can determine the categories of the recorded/tracked events. Click on a category in the table to see the event actions or event labels for that category.
Event Actions report - Through this report you can determine the actions of the recorded events. Click on an action in the table to see the event label or event category for that action.
Event Labels report - Through this report you can determine the labels of the recorded events. Click on a label in the table to see the event action or event category for that label.
Event Pages report - Through this report you can determine the web pages on which the events were tracked/recorded.
Event Flow report - Through this report you can visualize the order in which visitors track events on your website.
If you like this post then you should subscribe to my blog and follow me on twitter.
Related Posts
- Selecting the Right Attribution Model for Inbound Marketing
- How to use Web Analytics 2.0 to improve your conversions
- Ultimate Data Visualization Guide for SEO
- How to create your own Backlinks Analysis Tool
- How to Automate Event Tracking in Google Analytics
- 10 SEO Metrics you can’t live without
- Social interactions tracking through Google Analytics
- Google Analytics Account Setup Checklist
- Two Powerful ways to reduce bounce rate
- Google Analytics Rank Tracker Review
Tweet
This post is a guide on ‘event tracking’ feature in Google Analytics and is an attempt to explain ‘Event Tracking and Virtual PageViews from A to Z in an easy to understand language. So here we go.
- The Basics
- Generating virtual pageviews
- Best practices for creating virtual pageviews
- Setting up Event Tracking in Google Analytics
- Advantage of using Event Tracking over Virtual pageviews
- Best practices for setting up event tracking
- Event Tracking Reports
The Basics
The first thing that you need to understand is the meaning of ‘event’ from Google Analytics perspective. Event is a user’s interaction /activity with a webpage element like flash videos, gadgets, images, links etc. An event can be:
- Downloading a file
- Loading of Ajax, JavaScript or flash contents
- Loading of a dynamically generated webpage
- Loading of pop-ups, light boxes
- Loading of a flash video or a webpage
- Scrolling down the page
- Viewing of a flash video
- Viewing video footage of certain length
- Clicking on a video’s play/pause/stop button
- Interaction with a gadget
- Clicking on an image or a link
- Abandonment of a form
- Log-ins
- Sharing/printing a blog post, article, video or image
There are two types of events in Google Analytics:
- One which generate pageviews when they occur like clicking on an internal link on a webpage. In this case Google Analytics calls the _trackPageView() method each time such event occurs.
- One which doesn’t generate pageviews when they occur like: clicking on an external link, loading of Ajax/Flash content, downloading a file, viewing of a video, clicking on a video’s play button etc. In this case Google Analytics doesn’t call the _trackPageView() method each time such event occurs.
By default Google Analytics (GA) can’t track any event which doesn’t generate pageview when it occurs like: clicking on an external link, viewing of a flash video, downloading a file etc. You can track such events through virtual pageviews or event tracking. An event in event tracking reports of GA is made up of: category, action, label and numerical value. We will discuss them in detail later. Now lets start with virtual pageviews. It is a pageview which GA tracks even when no new page has actually been loaded into the browser.
Generating virtual pageviews
You can generate virtual pageviews by calling _trackPageView() method each time the event you want to track occurs.
Syntax: _gaq.push ([‘_trackPageView’,’name of your virtual page’]);
Examples:
<a href=”http://www.abc.com/gu/dw/seo-beginners-guide.pdf” onClick=”_gaq.push ([‘_trackPageView’,’/virtual/guides/download/seo-beginners-guide.pdf’]);”> Download SEO Beginners Guide</a>
<a href=”http://www.abc.com/gu/dw/social-media-guide.pdf” onClick=”_gaq.push ([‘_trackPageView’,’/virtual/guides/download/social-media-guide.pdf’]);”> Download Social Media Guide</a>
You can call _trackPageView() method using a JavaScript handler like onClick, onSubmit etc. You can create a virtual page view wherever you can call a JavaScript method. You should track those types of events using virtual pageviews which are equivalent of a page being viewed like: downloading a file, loading of Ajax, JavaScript or flash contents, loading of a dynamically generated webpage, loading of pop-ups, light boxes, scrolling down a page or when you want to track an event as a goal.
You can see virtual pageviews in ‘Top Content’ and ‘Content Drilldown’ reports in GA along with real page views. However note that ‘virtual page views’ are not highlighted as ‘virtual’ in the reports and you may have to use filter on the reporting interface to find them. One disadvantage of using virtual page views is that it can artificially inflate your overall page views. So the question is how you can distinguish virtual pageviews from real pageviews in GA reports. To do this start your virtual page name by ‘virtual’ and then search for ‘virtual’ using filter on the reporting interface. In this way you can easily spot virtual pageviews in GA report. For e.g.
_gaq.push ([‘_trackPageView’,’/virtual/guides/download/seo-beginners-guide.pdf]);

Searching for Virtual Pages in Google Analytics reports
Note: GA also calls the trackPageView() method in GATC (Google Analytics Tracking Code) each time a page is loaded by the browser. This method is called immediately after the _setAccount() method in GATC:
_gaq.push ([‘_setAccount’,’UA-12345-1’]);
_gaq.push ([‘_trackPageView’]);
Best practices for creating virtual pageviews
- Use clear and consistent naming conventions for your virtual pages.
- Start your virtual page name with the word ‘virtual’ so that you can easily spot them in the GA report.
- Create one or more virtual directories to categories your webpage elements. For e.g.
_gaq.push ([‘_trackPageView’,’virtual/guides/downloads/seo-beginners-guide.pdf]); - Create duplicate profiles which filter out virtual pageviews.
Setting up Event Tracking in Google Analytics
You can set up event tracking in GA by calling _trackEvent() method each time the event you want to track occurs. This method is used to record/track an event.
Syntax:
_gaq.push ([‘_trackEvent’,’event category’,’event action’,’event label’, event value]);
Event Category => It is the name given to group of similar events which you want to track. For e.g. ‘videos’
Event Action => It is the name given to the type of event you want to track for a particular webpage element. For e.g. ‘play’, ‘stop’, ‘pause’, ‘share’ etc.
Event Label => It is used to provide additional information about the webpage element you want to track like: title of a video, name of a gadget, name of the downloadable file etc.
Event Value => It is the numerical value assigned to the event you want to track. For e.g. download time, length of the video footage played or some dollar value.
Note: Specifying ‘event category’ and ‘event action’ in _trackEvent() method is mandatory. Whereas specifying ‘event label’ and ‘event value’ in _trackEvent() method is optional.
Examples:
<a href=”http://www.abc.com/gu/dw/seo-beginners-guide.pdf” onClick=”_gaq.push ([‘_trackEvent’,’guides’,’download-seo’,’seo-beginners-guide.pdf’,10]);”>Download SEO Beginners Guide</a>
<a href=”http://www.abc.com/gu/dw/social-media-guide.pdf” onClick=”_gaq.push ([‘_trackEvent’,’guides’,’download-social’,’social-media-guide.pdf’,10]);”>Download Social Media Guide</a>
There is a disadvantage of using duplicate ‘event action’ names across categories. The disadvantage is that unique events are incremented by unique action names. So if a user clicks on two different videos say ‘spiderman-2’ and ‘Aliens vs predator’ which have same action name say ‘play’, then in that case GA will report only one unique event even when the user clicked on two different videos. So action names should be unique. For e.g.
_gaq.push ([‘_trackEvent’,’videos’, ‘play-spiderman’,’Spiderman-2’,10]);
_gaq.push ([‘_trackEvent’,’videos’, ‘play-dog-out’,’Who lets the dog out’,10]);
_gaq.push ([‘_trackEvent’,’videos’, ‘play-aliens-predator’,’Alien vs predator’,10]);
You can call _trackEvent() method using a JavaScript handler like onClick, onSubmit etc. You can record an event wherever you can call a JavaScript method. You should track those type of events using ‘event tracking’ which are not equivalent of a page being viewed like: viewing of a flash video, viewing video footage of certain length, clicking on a video’s play/pause/stop button, interaction with a gadget, clicking on an image or a link, abandonment of a form, log-ins, sharing/printing a blog post, article, video or image etc. You decide the reporting structure through arguments of _trackEvent() method. You should avoid tracking highly repetitive events like mouse movements because GA can’t track more than 500 events per visit.
Advantage of using Event Tracking over Virtual pageviews
- Event tracking doesn’t artificially inflate your overall pageviews.
- Through event tracking reports available in GA you can analyze events in much greater details. For e.g. you can not only see how many times people watched your video but also what was the effect of video viewing on your site usage and e-commerce metrics.
Best practices for setting up event tracking
- Use clear and consistent naming conventions for event categories, event actions and event labels.
- Determine in advance all of the web page elements (like videos, gadget, image, external link etc) and type of events you want to track.
- Create a hierarchy of event categories, event actions and event labels that is scalable.Then work with your report users to make sure that your hierarchy is understandable.
Event Tracking Reports
![]()
The Event tracking reports are available under the ‘content’ report in Google Analytics. There are 4 event tracking reports available in Google Analytics:
- Event Tracking Overview report
- Event Tracking Top Events report
- Event Tracking Pages report
- Event Tracking Events Flow report
Event Tracking Overview report - This report provides overview of tracked events on your website like:
- Total events
- Unique events
- Event Value
- Avg. Value
- Visits with event
- Events/visit
- Top events
Total events => It is the total number of users’ interaction with tracked webpage elements. It is also the total number of times the _trackEvent() method was called. For e.g. if a visitor clicks on the ‘play’ button of a same video 5 times, then GA report Total events as 5 but unique events (number of unique interactions that occurred in a web session) as 1.
Event Value => It is the total value of an event or set of events.
Avg. Value => It is the average value of an event.
Visits with event => These are those web sessions in which at least one tracked event occurs.
Events/visit => It is the number of tracked events that occurred in a web session.
Top Events => It includes top event categories, top event actions and top event labels. You can find these metrics in Top events reports too.
Event Categories report - Through this report you can determine the categories of the recorded/tracked events. Click on a category in the table to see the event actions or event labels for that category.
Event Actions report - Through this report you can determine the actions of the recorded events. Click on an action in the table to see the event label or event category for that action.
Event Labels report - Through this report you can determine the labels of the recorded events. Click on a label in the table to see the event action or event category for that label.
Event Pages report - Through this report you can determine the web pages on which the events were tracked/recorded.
Event Flow report - Through this report you can visualize the order in which visitors track events on your website.
If you like this post then you should subscribe to my blog and follow me on twitter.
Related Posts
- Selecting the Right Attribution Model for Inbound Marketing
- How to use Web Analytics 2.0 to improve your conversions
- Ultimate Data Visualization Guide for SEO
- How to create your own Backlinks Analysis Tool
- How to Automate Event Tracking in Google Analytics
- 10 SEO Metrics you can’t live without
- Social interactions tracking through Google Analytics
- Google Analytics Account Setup Checklist
- Two Powerful ways to reduce bounce rate
- Google Analytics Rank Tracker Review
About the Author: Himanshu Sharma is the founder of seotakeaways.com which provides SEO Consulting, PPC Management and Analytics Consulting services to medium and large size businesses. He holds a bachelors degree in ‘Internet Science’, is a member of 'Digital Analytics Association', a Google Analytics Certified Individual and a Certified Web Analyst. He is also the founder of EventEducation.com and EventPlanningForum.net.
My business thrives on referrals, so I really appreciate recommendations to people who would benefit from my help. Please feel free to endorse/forward my LinkedIn Profile to your clients, colleagues, friends and others you feel would benefit from SEO, PPC or Web Analytics.
-
http://antennainstallationssydney.com.au/ Phil
-
http://Website Jonathan
-
http://Website lbcod
-
http://Website Eric
-
http://asdruble.com.br Bruno Davico Simões
-
-
http://Website Karl
-
http://Website David
-
http://Website Robbin
-
http://Website Sean
-
http://Website Jitender
-
http://Website Richard Burton
-
http://Website Miranda
-
http://Website Steve
-
http://Website John
-
http://Website ChrisrockSEO
-
http://Website seo-god
-
http://Website rupesh82
-
http://Website Vinay Gupta
-
http://seo.tolafamakinwa.net/ Tola
-
http://www.countryclubindia.net/ Ali
-
http://Website Ana
-
http://Website Analytics Nerd
-
http://Website SpanishSEO
-
http://Website Gari
-
http://Website rogue-seo
-
http://Website Marco
-
http://Website Tyler
-
http://Website JanetSEO
-
http://Website Peter Silva
-
http://Website livelybrowsers
-
http://Website Sajeet
-
http://Website Sajeet
-
http://betterretail.wordpress.com Rishi Rawat
-
http://betterretail.wordpress.com Rishi Rawat
-
http://Website Alex
-
http://www.windfery.com Windfery
-
http://Website Mohit
-
Pisces
-
Pisces
-
http://seoinspection.com Google Traffic
-
http://in.linkedin.com/in/googlewebanalyticsconsultant Mridul Gupta
-
rashmi
-
http://cheaptilerwakefield.com JD
-
http://www.LAokay.com Steve G
-
-
http://zaichina.net Daniel Mendez
-
Manoj
-
http://montreal.inseoservices.com IN SEO Services
-
Chris






...