Article

Jul 22, 2013
NYCSEM

Google Analytics Event Tracking Made the Easiest

I recently authored a post that contained a couple of handy scripts to track YouTube views and outbound links in Google Analytics Event Tracking without having to markup your HTML. I recently found an even easier way to do the most common event tracking needs with just one script.

Google Analytics Event Tracking with GASCardinal Path, a leader in search engine marketing and web analysis, has an Analytics extension called Google Analytics on Steroids that accomplishes all the following event tracking:

    • Download Tracking
    • Outbound Link Tracking
    • MaxScroll Tracking – very cool addition to find how far down your page users are scrolling
    • Form Tracking
    • Youtube Video Tracking
    • Vimeo Video Tracking
    • HTML5 Video/Audio Tracking
    • MailTo Tracking

Installing the simple tag automatically adds all the above into your Analytics events reporting. You can download the gas.min.js script and install it on your site or reference it from cdnjs as show below.  It automatically pulls the ga.js script. There is no option to pull the DoubleClick script (dc.js) if you are using Analytics to build remarketing lists.

<script type="text/javascript">
var _gas = _gas || [];
_gas.push(['_setAccount', 'UA-YYYYYY-Y']); // REPLACE WITH YOUR GA NUMBER
_gas.push(['_setDomainName', '.mydomain.com']); // REPLACE WITH YOUR DOMAIN
_gas.push(['_trackPageview']);
_gas.push(['_gasTrackForms']);
_gas.push(['_gasTrackOutboundLinks']);
_gas.push(['_gasTrackMaxScroll']);
_gas.push(['_gasTrackDownloads']);
_gas.push(['_gasTrackYoutube', {force: true}]);
_gas.push(['_gasTrackVimeo', {force: true}]);
_gas.push(['_gasTrackMailto']);

(function() {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = '//cdnjs.cloudflare.com/ajax/libs/gas/1.10.1/gas.min.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>

The script also adds other features that can help with the following:

  • Social Media Hit Tracking
  • ECommerce Tracking using metas
  • Cross Domain Setups
  • Multi-account Tracking
  • Changing Page Titles
  • Extensible Custom Hooks (documentation)

Of course, this does not work with the universal analytics script (analytics.js), but I imagine they will release a version that will, and I’ll be sure to post when they do.

1 thought on “Google Analytics Event Tracking Made the Easiest”

  1. UPDATE: I reached out to Cardinal Path concerning the availability of GAS for the beta universal analytics. Stephane Hamel,
    Director, Strategic Services, explained that while they are developing the features internally there is no plan to release the product as open source.

Leave a Comment

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

Contact Us

We will get back to you as soon as we can, usually during the same business day.

We want to answer any of your questions about NYC SEM and what we can do for you. Please call us or use the contact form below to send an email.

    NYC SEM Helps Businesses Increase leads and Grow Sales with Digital Advertising and Analytics

    Scroll to Top