Track Product Spec Sheet PDF Downloads in Google Analytics

Most decent eCommerce websites that sell complex products have some sort of downloadable PDF specifications sheet or marketing collateral. The problem with these downloads is that they aren’t automagically tracked in popular infomatic systems like Google Analytics. It turns out adding tracking to these under ‘Events’ is as straight forward as inserting a bit of inline JavaScript attaching an onclick event to your PDF download anchor links. Adam Buchanan covers this in his post on the subject, but this really wastes two extra dimensions of data filtering by having every PDF be a ‘Download’ and ‘PDF’ – only differentiating these digital collateral downloads based on their hrefs, which can be lengthy and unfriendly. Dynamically setting these allows you to associate the download with an individual product, category, or type of download for better data segmentation.

If you’re using jQuery, you can take the below snippet and directly insert it for eCommerce PDF Download tracking – otherwise be sure to include the jQuery library as it won’t work without it. Also remember to make sure to add the CSS class ‘pdf’ to any PDF links and modify the line //product name to be the jQuery selector for the individual product’s name or category you’d like to track. (below is setup for a Magento webstore).


<script>
    $("a[class='pdf']").each(function(index) {
      var pdfProduct = $('h1[name=prod_name]').html();   //product name
      var pdfLabel = $(this).html();  //PDF anchor text
      var pdfOnClick = "_gaq.push(['_trackEvent', 'PDF Download', '" + pdfProduct + "', '" + pdfLabel + "']);";
      $(this).attr("onClick", pdfOnClick);
    });
</script>

Now instead of having a ‘Download’ event which then lets you drilldown into a ‘PDF’ then see the end URL of the document someone downloaded – you can use the ‘PDF’ level of data aggregation to make some interesting assertions about either your product categories or individual products themselves. Change the ‘PDF Download’ and modify the CSS Class in the jQuery selector to even further segment into Product Specs, Whitepapers, and other PDF content available for download. Find out if maybe there are some products or product categories on your website that people are just more interested in getting more information about before they make a decision. Use this to identify what products and categories users are seeking supplementary content for to inform your content marketing strategy and guide your web marketing decisions.

Posted in Posts, Web Development

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

My Tweets