How to Use Event Tracking in Analytics

If you use Google Analytics to track page views and popular content on your website, you may be interested in accessing more data. If you enable Event Tracking for your URL in Google Analytics, you can track user interaction on your site. This allows you to see things such as downloads and clicks on the site. In order to use event tracking, you must be able to edit the HTML files of your site to insert the proper coding. Inserting the coding is all you need to do for event tracking to be enabled on the site.

Instructions

    • 1

      Log into your Google Analytics account online.

    • 2

      Add the standard tracking code to the </head> closing tag of your website template. The code is:

      <script type="text/javascript">

        var _gaq = _gaq || [];

        _gaq.push(['_setAccount', 'UA-XXXXX-X']);

        _gaq.push(['_trackPageview']);

        (function() {

          var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;

          ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';

          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);

        })();

      </script>

      In the code, replace the Xs in "UA-XXXXX-X" with the web property ID assigned to the URL by Google Analytics. You will see it listed by the URL in your account.

    • 3

      Insert the following line of code into the standard code on the line directly after "_gaq.push(['_trackPageview']);"

      _gaq.push (['_trackEvent(category, action, opt_label, opt_value']);

      In this line of code, the category and action are the only required parts. Replace category with a specified category on your site, such as Videos or Images for a multimedia site. For action, you must enter an action that corresponds with an action a user can take on the page, such as "Play" or "Download." The optional label can be anything, such as the name of the file. The optional value can also be anything, such as the file type or download time.

    • 4

      View the report for the enabled event tracking by logging into your Google Analytics account, clicking on the URL for the site and then "Content" from the sidebar.

Related Searches:

References

Resources

Comments

Related Ads

Featured