Koozai > Blog > The Complete Google Analytics Event Tracking Guide Plus 10 Amazing Examples

The Complete Google Analytics Event Tracking Guide Plus 10 Amazing Examples

| 18 minutes to read

Over my time working with Google Analytics accounts I have come across many reasons to use Event Tracking, so much so that I now wonder why there are still websites out there that do not utilise this fantastic resource. Here, I’m going to explain what it is, the benefits, the code and examples, covering my favourite things to use Event Tracking for.

With just a small amount of extra code, you can start collecting data on a whole host of additional activities that happen on your website which cannot be tracked with the standard Google Analytics code. From clicks on buttons or links, to how much of a form was filled in and even organic keyword rank data!

The data is also completely custom to you – you get to choose 4 pieces of information to pass into Google Analytics, specific to each activity.

Event Tracking works through passing the following information to Google Analytics:

Category, Action, Label and Value

There is one other field that can be used in the code, non-interaction, but this does not pass any additional data, so we’ll come back to it later. Also, you don’t need to include a tag saying which page the Event happened on, as this is captured through the standard trackPageview functionality.

Google Analytics Top Events Report

The data comes under the Content Report, then Events. Have a look at how the information is accessed before deciding on how to label the activities on your website. You will want to consider grouping similar activities in to the same action, which can then be broken down by category and label, rather than having too many differing actions. Similarly with categories, try to find ways to define these in order to enable you to group them and analyse similar ones together, whilst maintaining the ability to break them down through labels and actions.

I’ll cover some examples of how to name your activities in each of the examples below so that you start to get a feel for what you can do.

Basic Event Tracking Code

Broken down to the basics, the code is structured like so:

_trackEvent(category, action, opt_label, opt_value, opt_noninteraction)

Replace each aspect with the data that you want reported. Although you only need to include category and action, the others are optional.

As an example, to track PDF downloads of a Whitepaper called SEO is Great, I have chosen to use:

  • A category for all my Whitepaper activity
  • An action of ‘download’ for all downloads across the site
  • A label to distinguish which resource sees the activity
  • A value of 5 (based on the perceived value or arbitrary scale, whatever works for your business)
  • A non-interaction setting of true (meaning I do not want activity here to impact by bounce rate)

Which in its most basic format would be:

_trackEvent(‘whitepaper’, ‘download’, ‘SEO is great’, 5, true)

The important thing to remember, is that if you want the Event to fire data when someone clicks something, you will need to put the code inside an onClick function, like so:

onClick=”_gaq.push([‘_trackEvent’, ‘whitepaper’, ‘download’, ‘SEO is great’, 5, true]);”

In this example, we’re tracking clicks of a PDF, so the full code of the link would be:

<a href=”/downloads/whitepapers/seo-is-great.pdf” onClick=”_gaq.push([‘_trackEvent’, ‘whitepaper’, ‘download’, ‘SEO is great’, 5, true]);” target=”_blank”>SEO Is Great Whitepaper</a>

You can see how the extra line of code just sits inside the code for the link and after you’ve done it once you can use the same example but just replace the bits that need to change. Copy and paste is your best friend when you’re not a coder!

Additionally, because it is JavaScript, you can insert the data dynamically, instead of using static information. For example:

<a href=”/downloads/whitepapers/seo-is-great.pdf” onClick=”_gaq.push([‘_trackEvent’, ‘whitepaper’, ‘download’, pdfName, pdfValue, true]);” target=”_blank”>SEO Is Great Whitepaper</a>

In this example you would have to define the pdfName and pdfValue variables elsewhere in the code, so that the JavaScript knows which bit of information to pull in.

Events and Bounce Rate

When using Event Tracking on a website, you will need to be aware that Events will impact the bounce rate of the page because by default, Events count as an interaction (not a bounce) in the same way as visiting another page.

If you do not want Events to impact your bounce rate in this way, you will need to use the non-interaction part of the code to specify that it should not be counted as an interaction and thus, should be ignored for the bounce rate calculation. To do this, set the opt_noninteraction field to true as I did in the above example.

Value of Events

As with goals and e-commerce data, having a value in your reports can give you so much more insight into performance and success, so I would highly recommend setting values wherever possible. In Event Tracking code, the value is an integer that can be used for whatever metric you want, as long as it’s a positive number.

You can either set the value based on what the Event is worth to the business, i.e. clicks of this link mean someone has purchased something worth £12, so the value should be set as 12.

If you don’t know what value something has or if it’s for things of varying total value, you can try and work it out based on the average final revenue and then times this by the conversion rate (the likelihood you will get revenue from the Event) to work out how much each Event could be contributing.

Alternatively, if you have no real way of working out actual revenue, you can set the values as arbitrary numbers on a scale of importance. This will help you compare a visits/pages/traffic sources that have measured 100 low importance interactions compared to visits/pages/traffic sources that have measured just a couple of very high importance Events.

Using either method here will then give you a much better idea of how things are performing, especially when you’re tracking more than one type of Event.

Alternatively, you may choose to use the value field for another metric such as time (for tracking videos watched or time on site) or as search engines ranking position. If you use these then you may want to make sure that everyone reporting from your Google Analytics account is aware that these values are not money!

Event Tracking Value - Time On Site

Reporting on Events in Google Analytics

Before I dive into all the examples, let’s take a quick look at how the data is reported and what you can get from it.

Events Reports In Google Analytics NavigationHere are the core metrics:

  • Total Events: How many Events were recorded
  • Unique Events: How many unique actions happened (de-duped version of total Events)
  • Event Value: The total value recorded (only you know whether it’s £, $, time or another metric!)
  • Avg. Value: The average value across all Events
  • Visits with Event: How many visits contained an Event
  • Events / Visit: The average number of Events recorded per Visit

These are then broken down by Category, Action, Label (or a combination of these) and the data can also be reviewed by the pages on which Events happened.

Once you have chosen dimension to break the data down by (i.e. a category that you want to analyse), the data will be shown in more depth for this and a breadcrumb appears at the top allowing you to change this or go back to All.

I would also recommend tracking your most important Events as goals so that you can see data relating to these in the standard reports against other data and use the metrics to help you work out the value and ROI of your website.

Event Tracking Examples, You Say?

So now you’ve got the basics, let’s crack on with some examples of when and how you can use Event Tracking to take your web analytics to the next level! The methods I’m going to cover are:

Basic tracking of clicks/interaction:

  1. External links
  2. Internal banners
  3. Sign-ups, log-ins and form submissions
  4. Downloads

Medium difficulty:

  1. Gadgets
  2. Videos
  3. Social sharing button interaction

Advanced but awesome:

  1. Rank tracking (easy implementation and awesome data!)
  2. Form completion progress/ drop out
  3. Scroll reach

Basic Tracking (Easiest Difficulty)

These event tracking functions are easiest to implement and provide some really valuable and often essential information about user behaviour.

Tracking Clicks and Interaction

This is the most common use for Event Tracking – how many times people click on a certain thing. The only limit here is your imagination! If you’re not sure where to start, take a screen shot of a couple of pages of your website and circle all the things that users can click, then think about what value and use each of these actions is to you. From this you can decide what to track and what naming structure you might need to use to organise the data.

Clicks on External Links

Tracking clicks on links to other websites can enable you to measure the following:

  • Clicks on adverts
  • Click through to sister sites or sub domains
  • Clicks to social profiles
  • Clicks to the resources you have provided
  • Clicks to your YouTube Channel or other sites you’re promoting
  • Clicks on AdSense and affiliate links
  • Clicks on Live Chat buttons (usually an external service)

Each of these has its own benefits and some will have more significant monetary value than others, but each will be valuable data because if no one clicks the links, why should you fill your website with them? This data can help you decide which ones are of most use to your users, as well as which ones are valuable to your business.

The code for these links might looks like this:

<a href=”https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide” onClick=”_gaq.push([‘_trackEvent’, ‘resource’, ‘outbound link’, ‘https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide’, 1, true]);” target=”_blank”>Google’s Guide to Event Tracking</a>

I’ve named this as a resource clicked from an outbound link with a value of 1 and I have told it to not use clicks on this to impact the bounce rate of the page.

Internal Banner Tracking

Have you got a rotating banner on your site? Or somewhere to place a banner but you want to know which one performs best?

Adding Event Tracking code to your internal banners and carousels (rotating banners) can help you identify the best banners to use on your website – which type of content users are most interested in and which banners work best at attracting clicks. You can also tie back the data to see the goal values from users who clicked each banner to work out if any outperform others in bringing value to your business.

Not only can you track the banners themselves, but you can track the navigation buttons that people use to flick between rotating banners or forward and backwards arrows if you have them.

The code for these links might looks like this:

<a href=”#banner1″ onClick=”_gaq.push([‘_trackEvent’, ‘banner’, ‘internal link’, ‘banner 1’]);”>1</a>

So here I am labelling the action as a click on an internal link, with the category banner. I’ve used the label field to specify which banner it is (yours should have a more informative name than 1!). I’ve decided to remove the value and non-interaction fields, as I don’t see a value being attributed to this click and it counts as interaction to further content on my website. Therefore, I’m happy for this click to stop the views being counted as a bounce.

Signups, Log-ins and Form Submissions

Example of a Sign Up BoxHave you got any forms on the site where users can throw in some details and click go? Whether it’s signing up, signing in or signing their life away, you can track it! All you need to do is put the code on the submit button and you will be able to track how many times this is clicked.

<input type=”submit” onClick=”_gaq.push([‘_trackEvent’, ‘form, ‘submit’, ’email subscription’, 10]);” value=”Subscribe to our email” />

You should be starting to see the pattern now, this example uses the category form, so that we can track other interactions from forms within the same place. The action is ‘submit’, with the label specifying which form it was, the value being 10, which is left to count towards the bounce rate.

Downloads

Throughout your site you might have files that people can open or download, but you can’t tag these pages with Google Analytics. The closest you can get is to tag clicks to open/download the files.

As above, a way to track downloads as Events is:

<a href=”/downloads/whitepapers/seo-is-great.pdf” onClick=”_gaq.push([‘_trackEvent’, ‘whitepaper’, ‘download’, ‘SEO is great’, 5, true]);” target=”_blank”>SEO Is Great Whitepaper</a>

Whether you’re promoting Whitepapers, flyers, fact sheets, spreadsheets or other items, you can set up Event Tracking to measure when they are clicked, as well as how many unique clicks they see and what value this provides to you. 

Medium Difficulty

These examples might need slightly more code knowledge or research to get right, but don’t let this put you off!

Gadgets

If you have interactive gadgets or widgets of any kind on your site, such as ratings, feedback pop ups, liked-that-try-this pop ups, calendar buttons or polls, you can add Event Tracking to get an idea of how much these are used and which ones work best.

I’ve put this under the middle difficulty section as some of these will require some extra code to get working, but a simple implementation might be:

<a href=”#” id=”submit_feedback” onClick=”_gaq.push([‘_trackEvent’, ‘feedback’, ‘submit’, ‘Did you find this useful?’,, true]);” target=”_blank”>Submit</a>

Here I have used the category ‘feedback’, so that any forms that also use the ‘submit’ action can be analysed individually by category, as well as all submission data being shown within the same data set. This allows for in-depth analysis of visits with anything submitted.

Videos

So you have videos on your site and stats on these through the video hosting platform – but how do you tie the success of these in with other data you have about activity on your site? By tagging the Play, Pause and Stop buttons with Event Tracking of course!

You can even set up Event Tracking to record how many seconds of the video was watched before the user stopped it.

Due to the way that videos are built into websites, you may find that you need to modify the code to work properly, but the final outcome you’d be looking to see will be something like:

onClick=”_gaq.push([‘_trackEvent’, ‘videos’, ‘play’, ‘video marketing is awesome’,]);”

Or for video duration:

_gaq.push([‘_trackEvent’, ‘videos’, ‘video duration’, ‘video marketing is awesome’, videoDuration]);

Rather than provide an additional 2,000 words on how to set everything up, here are some resources to get you started, depending on how you’re using videos:

Here’s a JavaScript library that in a few short steps can get your video activity tracking as Events (although with the naming convention that they have set, rather than one you choose yourself).

Here’s how to put Event Tracking code in Flash videos (and using FlowPlayer to make videos easier to handle on your site) by Luna Metrics.

Wistia users can follow this guide for embedding Event Tracking in their videos.

Social Sharing Button Interaction

Depending on how you have added social sharing buttons on your website will depend on how you can track the activity. You will also need to decide if you want to use Event Tracking for social media or whether the Social reports would be better for you. The Social report can give you more detailed and integrated data, see this guide for implementation and this blog post for using the Social reports in Google Analytics.

I do think that social tracking is best done within the Social reports, but if you still want to see this interaction as Events, here’s how:

If you’ve coded your social buttons yourself, you can manually add Event Tracking code around these, like so:

To add Event Tracking code to Twitter buttons:

<a href=”https://twitter.com/koozai_anna” onClick=”_gaq.push([‘_trackEvent’, ‘social media’, ‘twitter’, ‘Koozai_Anna’]);” target=”_blank”>Koozai_Anna on Twitter</a>

To add Event Tracking code to Facebook buttons:

<a href=”https://en-gb.facebook.com/koozai” onClick=”_gaq.push([‘_trackEvent’, ‘social media’, ‘facebook’, ‘Koozai on Facebook’]);” target=”_blank”>Koozai on Facebook</a>

As you can see, you don’t get a huge amount of information and you will require extra code to make this dynamic to save yourself having to hand code every link, but this method can work for basic set ups.

Alternatively, if you are using Twitter Web Intents, a Twitter service that can make it easy for people to follow and share your content without leaving your website, there is a full implementation guide to get this activity tracked as Events with lots of juicy information.

With Facebook, if you have used their code for Social Plugins you can work your Event Tracking in to this code using this guide.

Google+ interactivity automatically feeds data into your Social report in Google Analytics, however, if you want to put the data in to your Events report you will need to add some code. Again, Yoast has put together a tidy little guide here.

Advanced but Awesome

This section may need additional code, but it will be worth it!

Rank Tracking (easy implementation and amazing reports)

You may have heard of using a filter in Google Analytics to show organic keyword positions in the keyword report, but this method, as outlined recently by Justin Cutroni, allows for so much more than that!

For the full implementation and information about this please read the original post.

It involves adding one small section of code to your website which then enables you to pass Event Tracking data in to Google Analytics in the following way:

  • Category: RankTracker (so all the data is grouped nice and easily)
  • Action: the keyword the visitor used
  • Label: the landing page (which in other Event Tracking is gathered through the Event page report but is very useful to grab as its own metric here)
  • Value: the rank that your website was when it was clicked
  • Non-interaction: True so that your bounce rate is not affected

Some of the uses for this are:

  • Finding the average rank of keywords – through the average value report
  • To group keywords and review performance based on the type of keyword (i.e. brand, product)
  • To track rankings of keywords over time on a graph
  • To see which pages perform well for which keywords

So what are you waiting for?! Get over to cutroni.com and implement this today!

Form Completion Progress and Submissions (code required)

Ever wondered how many times your forms are left incomplete? Which fields cause people to run away in fear or give up? Ever tried to guess how to improve your forms without using actual data?

Well now you can start to make informed decisions and get a detailed analysis for forms with the use of Event Tracking!

Rather than me writing the code for you, the lovely guys at Luna Metrics have recently provided a version that you can use.

There are two chunks of code involved – one to fire an Event every time a cursor leaves a form field and the second to set jQuery up. You only have to customise a few areas of the example to make it work for your form.

If you have budget available, then I would recommend using a different tool, such as ClickTale, to give you this data in a much more presentable and usable format. However, for those websites that don’t have scope for extra analytics budget, the above method is your next best alternative.

Scroll Reach (advanced implementation)

Again, you could use a dedicated tool such as ClickTale to analyse how far users scroll down your website pages, but if you want the data all in one place, you can utilise Event Tracking to measure this for you!

Now for this, I also can’t take any credit for putting the code together, the best write up on how to do this is found on Justin Cutroni’s blog and was put together by some of the best minds in web analytics!

You can find the full instructions here.

Conclusion

I think that’s enough for now! I hope that these ideas, examples of the code and resources will help you improve and get a lot from your own Event Tracking strategy. The data can be full of insights you never thought you could see! Remember though – why add the tracking code if no one’s going to use the data? Put a plan together for what metrics are going to be most useful to you and who/how they should be reported on before you decide on the implementation. This can also help you work out how best to name your Events to allow for the best analysis.

And after all that, if you need help improving the tracking on your website, we can help! Just give us a call to talk about our analytics services.

UPDATE: Unnecessary ‘ signs removed from value fields

Responses

  1. Graeme Benge avatar

    Hi Greg,

    If a site is using a tag manager solution to deploy tags then you won’t be able to see anything if they have removed the hard code.

    If the code exists on the page, searching for …onClick=”ga(‘send’… should reveal event tracking for Universal Analytics. For classic ga event tracking try looking for …_trackEvent(…

    Hope that helps Greg

    Graeme

  2. Greg avatar
    Greg

    Is there an easy way to locate the Event Tracking code on a website?

  3. Graeme Benge avatar

    Hi Caitlin,

    Good question. Within GA you can configure a goal using the attributes of your Event that will be viewable in the most used reports.

    Thing is there are only so many goals you can use (20) and yet you can set up hundreds of events to fire on a page. And hundreds of different ones to fire on another page!

    Within the Behaviour menu, you’ll see Events and here every event that fires will be collected. So it’s worth thinking about what you capture and how you capture it in GA.

    Creating Custom Reports is a great way to filter out what info you don’t need and focus entirely on the key metrics that demonstrate site performance.

    Hope this helps, thanks for commenting.
    Graeme

  4. Caitlin B. avatar
    Caitlin B.

    Hi! Thanks for posting this. It breaks it down nicely. But, I have a question. I don’t have a ton of GA knowledge so I’m wondering what work is needed on the front end in GA to make sure this data comes in properly. Do I just need to insert the code and wait for it to come back to GA? Or do I need to set up categories and such in GA and then insert the code?

  5. Matteo avatar
    Matteo

    Thank you very much Graeme for your answer; what you’re suggesting is exactly what i’m planning to do, so i hope to be in the right direction, thanks again!

  6. Eric avatar

    This is amazing! Thank you for explaining all of this in terms that a normal person can actually understand.

  7. Graeme Benge avatar

    Hi Matteo,

    Thanks for your comment and question. Anna no longer works with us however you might be able to take advantage of event tracking to fire when a page loads a banner if there a unique identifier of some sort to track.

    In theory this post by @hu_me looks to work well with what you’re looking to achieve:
    https://marketlytics.com/tracking-banner-impressions-using-google-tag-manager-and-universal-analytics/

    Let us know how you get on. Thanks again for commenting Matteo!
    Graeme

  8. Matteo Vinci avatar
    Matteo Vinci

    Very interesting and enlightining post, Anna. I’m trying to find out how to monitor impressions on specific banner on my website. How do you think could I do?

  9. jas avatar
    jas

    If a site is not using asynchronous tracking, but uses the traditional tag at the bottom of the page. Is there a way to use event tracking in this setup?

  10. Mahesh avatar
    Mahesh

    Found it really useful, as a beginner ! Thanks a lot :)

  11. Nick Soper avatar

    Watched the video, read the blog post, so incredibly helpful. Thanks.

  12. cpk avatar
    cpk

    I’m trying to track pdf downloads . I’ve followed all the instructions on defining categories, actions etc, and put them into the link to the pdf as an onclick event, just like the article said. Problem is, I go to Behavior > Events > Overview, and see no evidence of any events on my website. Am I missing a step? (yes, GA tracking code is in head of document)

  13. an3navarro avatar

    Hi Anna,

    Congrats for the article.
    Gotta a doubt though: you say

    “Tracking clicks on links to other websites can enable you to measure the following – Clicks on AdSense and affiliate links”

    But I can’t find the way to measure such clicks, I’ve also done a deep research on the Internet and I can’t find anything. It’s being quite complicated to assign page value base on outbound events since this information is separated into the adsense reports within GA.

    Anyone knows a method to measure adsense outbound clicks and/or add this to the objetive value?

    Thanks in advance and keep up the good work!

  14. Andrew Holden avatar

    Note – the Yoast’ Analytics plugin uses the older ga.js format and not the recommended analytics.js format.

    Therefore, for event tracking you may wish to use one of the “universal analytics” plugins available for WordPress such as this one: https://wordpress.org/plugins/universal-analytics/

    While Google’s documentation suggests support for both ga.js and analytics.js even tracking/syntaxes, I’ve had more luck with the more recent version.

    Yoast has a post on this topic and plans to release an analytics.js update later this year:

    https://kb.yoast.com/article/125-universal-analytics

  15. Judy avatar

    Great article! Can you tell me is this the same code to use for Universal Analytics – analytics.js? I am getting confused, because i am under the impression there is a slightly different code for UA…ultimately I am trying to simply track a pdf download:) Thanks in advance for any insight.

    1. Graeme Benge avatar

      Hi Judy, UA does mean a change in event tracking. It goes from an onclick event to a ga send event. More can be found here:

      https://developers.google.com/analytics/devguides/collection/analyticsjs/events

  16. WMK avatar
    WMK

    Current Google Analytics Menu does not include a “Content” menu? Mine shows:
    Dashboards
    Shortcuts
    Intelligence Events
    Real-Time
    Audience
    Acquisition
    Behavior
    Conversions

    Menu in article screenshot https://www.koozai.com//wp-content/uploads/2013/01/finding-event-reports.jpg is different:
    Real-Time
    Audience
    Traffic Sources
    Content
    Conversions

  17. Jo avatar
    Jo

    Hi Gemma,

    Thanks a lot for you quick reply!

  18. Jo avatar
    Jo

    Hi Anna,

    Thank you for this very useful article.

    I am still a bit confused as to how to set up event tracking: in your article, you don’t seem to mention anything about setting anything up in google analytics under the admin > goals section.

    Is it a matter of either implementing the codes in your article or setting up the goals under the admin section? Or do I have to do both?

    thanks!

    1. Gemma Holloway avatar

      Hi Jo,

      You only need to set up a goal, as well as the code, if you wish to track that particular event as a conversion (i.e. want it to appear within the Conversions report in GA).

      If you are happy for the event to simply be registered as an event (i.e. appear in the Events report in GA only) then only the code needs to be implemented.

      Thanks,

      Gemma

  19. Jack avatar
    Jack

    Hi Guys,

    Can any one help me to track download clicks in Google Universal. I used this code but it doesn’t work

    plz help me

    1. BenMc avatar
      BenMc

      @Jack:
      I’ve just gone through this myself. The code you need seems to be different for Universal vs the older GA.

      Instead of:

      onClick=”_gaq.push([‘_trackEvent’, ‘whitepaper’, ‘download’, ‘SEO is great’, 5, true]);”

      Try:

      onClick=”ga(‘send’, ‘event’, ‘whitepaper’, ‘download’, ‘SEO is great’, 5);”

      This format is working for me. Lots of info here:
      https://developers.google.com/analytics/devguides/collection/analyticsjs/events

  20. Alex Paps avatar
    Alex Paps

    Awesome piece of information! Thank you Anna.

    Quick question please: Do you know if there is any way to set up an emailed alert for when it triggers? When I have an event completion?
    (not the weekly or daily reports that I can set up for the events overview !)

    Thanks in advance!

  21. Alex.H avatar
    Alex.H

    Hi guys,

    Since the new updates I saw that
    onClick=”_gaq.push([‘_trackEvent’, ‘videos’, ‘play’, ‘video marketing is awesome’,]);”
    is obsolete and that we have to do this :
    https://developers.google.com/analytics/devguides/collection/analyticsjs/events#usingjquery

    I don’t understand how to implement these trackers for events. Did somebody have to deal with this allready ?

    Thanks,

    Alex.

    1. Vagelis avatar
      Vagelis

      What you said is about Universal Analytics.

  22. Pradeep Unni avatar
    Pradeep Unni

    Thanks Anna…. Thanks for sharing all this information. Keep rocking :-)

  23. Heather Bell avatar
    Heather Bell

    You are a star. Thank you for the concise explanation.

  24. Sangho avatar
    Sangho

    Good write up!

    Just wondering how you deal with externally hosted videos and cookie information exchange. Will this work automatically or do you need additional scripting?

    @Jan: there is an event flow report in GA. It should answer your questions.

  25. Andrew avatar

    This is an epic resource, and perfect for me as I’m just getting into event tracking. It took me at least one coding syntax error, but I’m now up and running. Thanks for sharing all of this information.

  26. Jan avatar
    Jan

    Hi Anna,

    Thanks for this post!

    I was wondering if you also know something about the reporting of the events. I have put events into place, but now I would like to know things like:

    – What series of events do users follow? (or, per user what events were triggered)
    – How many users tracked 2 or more events in the last week?

    Is it possible to get reports like that? I am struggling with this issue for some time…

    Thanks!
    Jan

  27. Marco avatar

    Hi Anna, great post ;)

    I added GA’s track event in company’s webpage and work it, but when customer copy&paste the email(in our webpage email is textual), for example didn’t click over button only copy and paste in your webmail, how do I can track this event?

    Other thing, GA tracked as event 1 goal when clicked on “send button” but didn’t send email….or cannot send mail form because missed a data, number, wrong text and cannot validate it….

    How I to do for fixed that?

    Thanks,
    BR
    Marco

  28. Neil avatar

    Anna, you’re an angel!

    I’ve searched high and low for someone that could explain this in plain English. You did – and with awesome examples!

    Off to track some ‘Buy Now’ button clicks…

    Thanks :)

  29. Jennifer avatar
    Jennifer

    Great article… above my pay grade. :)

    How do I track the number of clicks on the outbound facebook icon on my youtube channel?

    It is set to a client’s facebook page and they won’t share the inbound info. :(

    Thanks!

  30. Michelle avatar

    Thank you so much for the super detailed guide! This is my first time using Google Analytics and this will help speed up my learning!

    Only thing I hate is I now have to re-do all of the links I want to track to include the analytics tracking code. :(

  31. Charlie Southwell (@charliesaidthat) avatar

    This is still an amazing resource.

    Thanks for putting it together guys. Agree with Pritesh though. Naming conventions are vital for this to work well.

  32. Get Discount Coupon avatar

    Great. Great. Great Article…

    I have a question
    How can I link conversion to previous visit?
    Means I have phone call as conversion,
    Some visitor comes to our website by searching some keyword and makes a call and leaves the website. Another visitor comes(of course it comes by searching another keyword) to our website and we want to push previous call conversion to Google Analytics and want to bind it to actual previous visitor?

    Thank you for such a great post.

  33. Mark avatar

    Hi,

    how do i create a track event for copy&paste email ?

    Example, if in website have email’s link and i want to track thios event. Some people copy&paste that in your mailbox (peope haven’t Outlook Express or Mail for Mac).

    BR
    Marco

  34. Victor Clar avatar
    Victor Clar

    If i want to know if cross-sells are effective, or if the different elements in the product page (zoom, video, pan, alternative images, product reviews, etc) contribute to sales / higher revenue, I would like those events to have the value of the item’s price but only if it was actually purchased.

    I could also do segments filering all those events under ecommerce reports, but it would be easier to have the list of events with how much each event contributed in $s…

  35. Tom Bowen avatar

    Wouldn’t you in that case be using GA’s Ecommerce conversion tracking instead? I can’t think of what you’d be doing with Ecommerce to use an onclick event to track. Typically the last click in a checkout is to Submit a credit card, but you don’t know at that point if the credit card was accepted or not.

    Setting up Ecommerce tracking in Google Analytics lets you track everything easily, including the value of each order. I bet there is a good tutorial of it here on Koozai somewhere. If not, try googling for Justin Cutroni’s tutorial, titled “Google Analytics E-Commerce Tracking”.

  36. Victor Clar avatar
    Victor Clar

    Anna, amazing post and great comments! Just one question: if I’m tracking E-commerce, is it possible to have the value of the product as the value of the event?

  37. Abdi Mohammed avatar

    Hi Anna – thanks for the interesting and thorough write up. I did have a question though – is it possible for GA to report on Events (external clicks) without someone setting it up? The reason I say this is because I’ve logged onto a client account wanting to set it up and there is data already there, e.g. the URLs of affiliate links that have been clicked. I checked the code on the website and they do not seem to have added the extra bit of tracking….and I am pretty sure the client would not have known how to do it. Am I missing something? Sorry if the question is a little wayward!

    1. Anna Lewis avatar

      Hi Abdi, thanks for the comment. I imagine that the site will be using a plugin or tool which enables event tracking to work without you having to put the code in yourself, such as Google Analytics for WordPress by Joost de Valk. Alternatively it might be that it’s been built into the framework of the site so that additional code is not required.

      1. Tom Bowen avatar

        Abdi, try checking the source code as it is rendered by the browser with a View Source. Whether inserted with a plugin or a framework or something else, the GA code capturing the event should show up here, and that can help you investigate where it is coming from. If you do NOT see it in the View Source, then you’re right–it is not on the page, which would imply that there is some other page with the tracking code in it that is firing those events (either correctly or incorrectly). I think you could then do some advanced segmentation within Google Analytics to get a list of pages viewed by those who had triggered the events in question.

      2. Abdi Mohammed avatar

        Thanks very much Anna – that makes sense and on the same lines as my initial suspicions. As long as its set up that’s the most important thing.
        Thanks again for the prompt response :)

  38. Karen Keller avatar
    Karen Keller

    I need to put event tracking on a form submit. I’ve read elsewhere that there may be trouble in missing some events being tracked because immediately after calling that javascript the browser is going to submit the form and go to another webpage. Can you comment on that, how much do I have to worry about that? Your example on form submit doesn’t cover that eventuality. Also, there was some mention of a “utm.gif” tracking image not loading in time. What is that?

    1. Anna Lewis avatar

      Hi Karen, you’re right that this is an issue, the best way round it is to use this method: https://support.google.com/analytics/answer/1136920?hl=en-GB It puts a time delay in so that the event tracking has time to fire before the next action is completed.

  39. Nathan avatar
    Nathan

    I’ve found a nice wordpress plugin (WP Google Analytics Events) for tacking Google Analytics Events. So it’s pretty easy to add custom tracking to the clicks on links or any element, and even to create an event so to see if the users scroll into view. I’ve put it on my site it SO COOOL!.

  40. Pierre avatar

    TRULY AMAZING! Thanks for all your help Anna!

  41. shelby avatar

    Thank you. I was so used to using the old analytics interface and am happy this article was written! Thank you!

  42. Bharat avatar
    Bharat

    Hello, I am interested in knowing whether it is possible to track the timing through google analytics. Like at what time, how many number of users visited the page (which is kept for tracking). I would appreciate if any one can share the piece of the code for the same.

  43. Ady avatar
    Ady

    Thank you! I’ve been looking anything on pixel tracking and Google Analytics and I just have opened 20 tabs of technical jargon. Then I came across your article…
    Do you have anything about adding pixel tracking to a GA code? All I found out was the _utm.gif that is needed. Can you help me Anna, please?

  44. Jordan avatar
    Jordan

    Hi Anna,

    Thanks for the great guide. I don’t mean to be a critic, but I encountered one problem with the way you have demonstrated Custom Event Values. Your examples pass this value as a string by wrapping the value in quotation marks, whereas it should be passed as an Integer with no quotes.

    Example:
    <a href="/downloads/whitepapers/seo-is-great.pdf" onClick="_gaq.push([‘_trackEvent’, ‘whitepaper’, ‘download’, ‘SEO is great’, ‘5’, true]);" target="_blank">SEO Is Great Whitepaper</a>

    Should be:
    <a href="/downloads/whitepapers/seo-is-great.pdf" onClick="_gaq.push([‘_trackEvent’, ‘whitepaper’, ‘download’, ‘SEO is great’, 5, true]);" target="_blank">SEO Is Great Whitepaper</a>

    Thanks for the guide though. It really helped me until the brief hang-up there.

    1. Anna Lewis avatar

      Hi Jordan, thanks for your comment, just had a look back over and you’re right, I must have got a bit code blind! Have updated examples now. Apologies for the error.
      Anna.

  45. Matt avatar

    Anna, this is a great blog post! I was looking for a good article on how to use Google Event Tracking and now I’m excited to try it out. I’m happy GA has this function built in! Can’t imagine not using it!

  46. Dan Richardson avatar
    Dan Richardson

    Anna (or anyone) :)

    Do you need the onclick=javascript part too as part of the link code? thx

  47. Ryan avatar

    Which Google Analytics Plugin for wordpress are you using?

  48. Cory avatar
    Cory

    Hey Anna,

    How do you track between two events, for example the time between clicking something and closing:

    Open window Close window

    Can you track that?

    Thanks heaps,

  49. Tom avatar
    Tom

    Hi Anna, is it possible to track mailto clicks? Thanks, Tom

  50. kerry avatar
    kerry

    Hi Anna, where do mailto links fit in with this?

    Thanks

    1. Anna Lewis avatar

      Hi Kerry, Mailto links work just like any other link, you have an href which you can put the event tracking code alongside.

      1. kerry avatar
        kerry

        Hi Anna, I’ve tried that but it doesn’t work :( any chance I could get a bit of help? Thanks

  51. Don Alava avatar
    Don Alava

    Great post. I’m glad the search engine lead me to your post.

    I read that the first 10 event hits sent to Google Analytics are tracked immediately, thereafter tracking is rate limited to one event hit per second. Should I be concerned if a visitor has fired off 10 events before they reach a conversion form? For example, if a confirmation page gets served quickly upon submit, could Analytics potentially not track the 11th event due to the one second delay?

    1. Anna Lewis avatar

      Hi Don, you will have to be careful with the limits if you’re firing a lot of events, the limits could cause issues for you. It might be worth considering an option such as this one described by Matt Clarke: https://techpad.co.uk/content.php?sid=195

  52. ceri avatar
    ceri

    Great post Anna, The form submission i cant wait to implement and see whats happening, cheers for the link to Luna Metrics to.

    Ceri

  53. doron avatar
    doron

    Hi Anna. I am looking to add information about linking from my site to other sites. just to do copy past to this code ?
    and in what to put it in the analytics code ?
    Thank you

    Google’s Guide to Event Tracking

  54. mathew avatar
    mathew

    I use google Anaytics to generate site translate stats from our site : markham.ca.
    however the report from ga consists 2 letter language code ie fr, iw etc. how do list a label beside the language code fr : French, iw : Hebrew. pls advise

  55. Deepak avatar

    Great post Anna!!! Thanks for posting this article. can you please provide the video for the same to understating more about Event tracking…

  56. Liam avatar
    Liam

    I read somewhere that it may take time for the events to show up in GA reports. Is that true? You didn’t mention it, so maybe is is not the case, and also since I cannot now find anywhere that says it does take time.
    Very helpful page, by the way. Thanks.

    1. Anna Lewis avatar

      Hi Liam, I generally find that it takes a couple of hours for the data to come in but you might see partial data before that. In theory, it’s best to wait 24 hours to make sure the data is most likely to be accurate but for quick testing and troubleshooting (as well as tracking) you can use the new Events feature in real time reports.

  57. Ty Whalin avatar

    Awesome write up. Just implemented some event tracking last week. Spent several hours on Google Help for Analytic Event tracking. Now I come across your article in my inbox during inbox clean out day. Good value article for anyone.

  58. digdeep avatar
    digdeep

    Nice post on the implementation side. I am wondering how you get any use out of the reports?

    I am struggling with the concept of getting multiple events as a per column item in a report that for example shows visitor ID as a line item, then pulls in each event by that user as a column.

    At best, I can create a segment which grabs only the subset of users that have that event rather than the full visitor data.

    Unless i am missing something here, the reports are next to useless in GA. to put in context, aggregate values in the UI reports are pointless when you are looking at a website with a decent amount of traffic.

    Would love your thoughts around this :)

    thanks and very nice post.

    1. Anna Lewis avatar

      I generally break the reports down by categories and actions or through using segments to see activity about users who triggered certain events. If you need anything more than that then using an API export might be the best option.

  59. Mike avatar
    Mike

    Thanks for posting this article, Anna! I make use of Events quite extensively every day. What I’m struggling with currently is trying to tie those events to more granular Ecommerce metrics. Currently you can only combine transactions with Events. I’m wondering if anyone has come across a method to also combine Events with Ecommerce Product values (SKU, Category, etc.).

    Best of luck data mining, folks!

  60. Luke avatar
    Luke

    Thanks for the brilliant article Anna.

    I have a website with an online form sitewide. Is it possible to implement the event tracking code which automatically generates the URL per event tracking in Google Analytics?

    In other words I would like to avoid implementing an unique event tracking code per page as my site has hundreds of pages.

    Many thanks!

  61. Katherine Rincon avatar

    Hi Anna! Great post. We’re studying it section by section. Is there any way to use Event Tracking to track a pdf that is only accessed from an external banner ad? We do not have any clickthrough data on the banner ad, and were hoping to see how many hits on the pdf. We tried setting up a redirect where the referring page had the GA tracking code, but that didn’t work. Thanks so much for your help!

    1. Anna Lewis avatar

      Hi Katherine, if the link to the PDF is not on your site it won’t be able to trigger an Event as your Google Analytics code won’t be on the page with the Event tracking on it. I’d have thought a redirect could work but only if there was a time delay to allow for the Google Analytics code to load before the redirect happened. For advanced PDF tracking I recommend having a look at this article: https://www.jonoalderson.com/conjecture/advanced-pdf-tracking/ It might be that server side tracking would work for you. Hope that helps!

  62. Gerry White avatar

    Sorry nope – what is it your trying to do? – loads of plugins available – I love the Yoast one https://yoast.com/wordpress/google-analytics/

    Otherwise you can just switch to HTML view and it shoudl work …

  63. Jen avatar
    Jen

    Liked the post thanks. Would anyone know why it is that when I edit and add the code to my page to track my pdf download I end up getting all of the raw code showing up rather than my “download here” link ?

    Sorry for the Nube question

    1. Gerry White avatar

      whilst it sounds like a nube question – it is amazingly common – are you using a CMS? you generally have to add it to the code itself, and many CMS systems deliberately won’t let you… If it is WordPress we can hack it in.

    2. Jen avatar
      Jen

      Thanks for that, yes I am using WordPress would you happen to have made a tutorial for hacking the code into WordPress?

  64. Tom Bowen avatar

    Hi Anna,

    Really good article–spells things out as clear as I’ve ever seen and great examples.

    Is there a decent resource for trouble-shooting that you recommend? I implemented a simple external link click event, and have clicked the link myself but I still show zero events. I get no JavaScript errors when I run the Error Console in Firefox. I have no filters set up that would filter out my visit. I can see my visit in the real-time report. But no matter what, I still see zero events, so I’ve clearly implemented wrong, but don’t know what my problem is. How do you recommend one would troubleshoot this?

    1. Tom Bowen avatar

      A good debugging tool I found was the Google Analytics Tracking Debugger for Chrome (https://chrome.google.com/webstore/detail/google-analytics-debugger/). Using that within Chrome and opening the JavaScript console showed me an error that I was not able to see without it.

      That error was that my Value parameter was enclosed in quotes. I took those quotes out from around the numeric value, and I got no errors. I did see my event in the Real-Time monitor on GA.

      1. John Potter avatar

        I’m having exactly the same problem that Tom describes.

        I see my visit in the real-time report, but the event is not recorded.

        I’m using Yoast’s Google Analytics for WordPress plugin.

        I’ve tried using the debugger, but it shows no errors, even with the Value parameter enclosed in quotes as demonstrated in Anna’s example.

        Removing the quotes does not generate an error or record events.

  65. Nils avatar

    Thanks so much for the article! It was well written, well laid out and super informative. You convinced me to take the time to set up rank tracking, video interaction and form completion. Sweet!

  66. Melani Zannaki avatar
    Melani Zannaki

    That makes sense! Thank you for your help and this informative article :)

  67. Anna Lewis avatar

    Hi Melani, yes you would need to put the event tracking code on the PDF link, then set up a goal for the Event. You can either set a value within the Event Tracking code or you can set a value for the goal that you set up (or both if you want!). Hope that helps!

  68. Altoranking avatar
    Altoranking

    Thanks Anna!! That was a great eye opener within Google Analytics.

  69. Lenin Rodriguez avatar
    Lenin Rodriguez

    Thank you Anna,
    It seems that I was over thinking and didn’t noticed until later on and yes you are right, I can get the page name from that report.

    This is the first time I found your blog and it has tons of good articles, great job.
    Thanks again.

  70. Lenin Rodriguez avatar
    Lenin Rodriguez

    When using event tracking on a submit button is it possible to add the name of the page where it was click as the widget might be in different locations?
    Currently I’m just using the basic code but I would like to get the page where it was click for tracking. Any suggestions?

    onClick=”_gaq.push([‘_trackEvent’, ‘Quote’, ‘Instant’, ‘Submit’,, false]);”

    1. Anna Lewis avatar

      Hi Lenin – luckily for you the Events report in Google Analytics reports on this automatically. It’s found under Content > Events > Pages

      You could also add Page as a secondary dimension when reviewing this Event’s data in the Top Events reports.

      Hope that helps!
      Anna.

  71. Gerry White avatar

    So – quick question – why for a number of those events wouldn’t you use pages instead of events – I typically use for form submissions and downloads page tracking – if anyone was to ask me why – habit, pathing, goals and segmentation – is there a reason to use events?

    I use events for video related bits and I have tried to use it for elements such as social shares, the scrolling you mentioned, certain on page events such as carousel and panel expansion etc…

    Cheers Gerry

    p.s. custom vars article next ?

    1. Anna Lewis avatar

      Hi Gerry, thanks for your comment, you raise a good point. I have used both methods in the past (and outlined them in my previous article about how to track clicks on a link: https://www.koozai.com//analytics/how-to-track-clicks-on-a-link-in-google-analytics-7721/)

      My rationale for choosing which method to use comes down to whether or not I want the data in the content report (as virtual pageviews will ‘artificially’ inflate pageviews) and whether I want more data than just a pageview.

      For PDF downloads, form submission buttons etc, you’d be perfectly justified to use virtual pageviews instead, as theoretically you would be tracking it as a URL if it was able to have it’s own page.

      I’ve moved to using Event Tracking for things like this as it gives you better ways to break the data down. If I have two+ forms on the site I can create a goal for all forms in one more easily and also analyse the data quickly just by clicking the form Event category.

      Obviously scroll reach, page load time, video interactions are Event specific.

      So in some cases you can pick either method depending on where you want to see the data. The data has to make sense to you and suit your reports so you will need to choose what’s right for you in each situation.

      Hope that helps!

      1. Gerry White avatar

        Thanks! – that makes sense … GA has massively evolved and I haven’t used it daily (for 7 months now) and it helps when people talk through why one rathe than another!

  72. Rob Kingston avatar
    Rob Kingston

    Hi guys,

    Another interesting use for events in GA is tracking what your visitors copy from your site. I’ve popped together a small bit of code that allows you to track:

    – Text your visitors copy
    – The page they copied it from
    – The length of the copied text in characters

    It can be particularly useful if you have a content site (e.g. blog) and you want to track a different form of engagement. If you’re interested in how to install it and how it looks in Google Analytics check out my post here:

    https://www.optimisationbeacon.com/analytics/use-google-analytics-to-track-what-content-your-visitors-copy/

  73. Ravi Sodha avatar
    Ravi Sodha

    As always, great post!

    As an example, I have implemented menu event tracking. The menu consists of drop downs so we measure:

    1. Hovers over the drop down menu items
    2. Clicks on the menu items
    3. Clicks on the links within the drop downs

    Its really useful to compare interaction before and after making changes to the menu.

    On another note, we use event tracking to measure pdf downloads. We found it best to add a small delay (300 ms) to ensure the event tracking code fires before the PDF loads. Users don’t notice the delay but if you don’t add it, the code doesn’t always fire!

    I am planning to measure comments on my blog using events (as I will treat it as a goal).

  74. Ian Creek avatar
    Ian Creek

    Hi Anna – great post as always.

    One other use for event tracking that’s good for publishers or sites that have a lot of guest blogging, is to track impressions of Avatars. E.g. every time a bloggers image is shown alongside the content you trigger an event. You can then easily see how many impressions each blogger gets all in one place. I’m sure you could come up with some great reports off the back of that.

  75. Jim Banks avatar
    Jim Banks

    If you are using the plain old ga.js version of Google Analytics and running WordPress then Yoast has a plugin which does a lot of the recalibration of event tags for you.

    You can also get hold of GAS (Google Analytics on Steroids) which can be either a standalone, or a WordPress plugin, it means you don’t need to mess around with code (if you don’t want to).

    I’m doing more work with the analytics.js , dc.js and also messing around with Google Tag Manager, so the plugins tend not to work so well.

    Good post Anna.

  76. Robert Kingston avatar
    Robert Kingston

    Nice post, Anna. Love the examples.

    Another cool little advanced implementation is copy/paste tracking (I intend to post instructions to this on my site in the next week). Will keep you posted!

  77. Graeme Benge avatar

    Another totally average post Anna….;-)

    Could you expand a bit on the merits or when best to have event tracking impact bounce rate or when it’s best not to impact bounce rate?

    1. Anna Lewis avatar

      Thanks Graeme, good question.

      Every case will be different, but the way to work it out is to think about your situation and understand what the bounce rate is currently showing you and what it would be showing if you were to add the code for each situation, here’s some examples.

      Preventing an event from counting towards the bounce rate might be useful for:
      – Events that fire automatically (you don’t want every visit to count as a bounce! Use True to get a real measure)
      – Events that are measuring something that’s not specifically an interaction (i.e. page load time, video duration)
      – An activity that is meant to happen (maybe a log in box event tracking code could be blocked from counting so that the bounce rate can be used to tell you what % don’t make it through to the next page – would work best when the page has little other content than the log in box)

      Allowing the event to impact the bounce rate could suit:
      – Tracking PDFs as these count as viewing another page but can’t be tracked as a page in their own right
      – Tracking polls and forms as these are actual interaction.

      I hope that clears things up a bit!

  78. Paul Rogers avatar

    Hi Anna,

    Great post, events are really important for tracking engagement and so many people don’t use it in the right way.

    Something I’ve found really useful since it was introduced is event goals in GA, mainly for tracking conversion rates of people watching videos, using content in JS pop-outs, clicks on different affiliate links etc.

    1. Anna Lewis avatar

      Thanks Paul, yes the ability to set Goals for events matching a certain set of details makes them so much more useful! It’s great that you can pick and choose whether to have an event for exactly matching or containing a string of text in any of the fields (category, action, label or value), it’s so flexible that it suits almost every business need!

      1. Melani Zannaki avatar

        To set a Goal for an event, it is essential to have set the event first ?
        For example, a client of mine has a hotel website with a link where users can download a PDF. To track the clicks on the link, I have to add the additional code and then set a goal for the event?
        And because I am new to this, could you please give me an example ?

        Thank you in advance!

  79. Mit avatar

    The GA Config tool from Raven is briliant for event tracking, makes for quick and easy implementation

    https://gaconfig.com/

    1. Anna Lewis avatar

      Hi Mit, thanks for the comment – you’re right the Raven Tools GA Config is a useful tool both for normal code and event tracking, I’m just so used to tweaking the code myself now but for anyone who doesn’t like to mess with code then this makes it easy and failsafe!

  80. Pritesh Patel avatar

    Great post Anna.

    Will get my thinking cap on for some more things which could be tracked using event tracking.

    In the mean time, I came across this very VERY interesting article about ‘event tracking naming strategy’ which is well worth a read before setting up any event tracking: https://www.seerinteractive.com/blog/event-tracking-naming-strategy

    1. Anna Lewis avatar

      Thanks Pritesh, that’s a great resource for planning a naming convention! Definitely recommended reading for anyone wanting to use event tracking for more than one type of thing.

    2. Chris Le avatar

      Thanks for the mention Pritesh!

Leave a Reply

Your email address will not be published. Required fields are marked *

Gary Hainsworth

Senior Organic Data Specialist

Gary is our technical SEO specialist and boasts more than 10 years’ experience in the industry. With in-depth knowledge on site migrations and all aspects of technical SEO, he’s a valuable asset to our team. Gary’s worked with the likes of the V&A, Warburtons, the NHS and the Lake District National Park. He has a passion for guitars too, be that playing them, modifying them or even building them. Gary has appeared in Startups Magazine, Portsmouth News and Southampton.gov.uk.

Gary Hainsworth Read more about Gary Hainsworth
aspect-ratio
David Wilson

Digital Marketing News Update – April 2025

David Wilson
23rd Apr 2025
Content Marketing Blog
aspect-ratio
Sophie Roberts

Mastering the Messy Middle: Your Checklist for Success

Sophie Roberts
@hospitalitysoph
16th Apr 2025
aspect-ratio
Sophie Roberts

Why the 95-5 Rule Should Be at the Heart of Your B2B Marketing Strategy

Sophie Roberts
@hospitalitysoph
8th Apr 2025
SEO Blog
aspect-ratio
Laptop showing technical SEO results in a graph
David Wilson

Search Trends Report – April 2025 Update 

David Wilson
4th Apr 2025
Analytics

Digital Ideas Monthly

Sign up now and get our free monthly email. It’s filled with our favourite pieces of the news from the industry, SEO, PPC, Social Media and more. And, don’t forget – it’s free, so why haven’t you signed up already?