Search code examples
dotnetnuke2sxc

How can I track # of downloads with 2SXC?


I am using 2SXC to display a list of links to PDFs. But I want to be able to track the number of downloads when the users click on them. How would I do that?


Solution

  • We do this in a few places. Overall, I think the best approach is to use Google Analytics and learn how to track your own custom events. Its really convenient, you do not set up anything at all in Analytics, you just define things on the fly. Its worth reading up on and once you get it, you will find lots of uses.

    Here is a real, recent example. We have a site that needed to track clicks on a big button that took the user off to another site for scheduling. Added an id="onlineScheduling" to the tag, then added this to the page's document.ready():

    $('#onlineScheduling').on('click', function() {
      ga('send', {
        hitType: 'event',
        eventCategory: 'Main',
        eventAction: 'LinkClicked',
        eventLabel: 'Online Scheduling'
      });
    });
    

    Analytics just catches it, logs it, and makes it easy to find/use. Then just go to Reports/Behavior, Events, Overview. Put anything you want in Category, Action, and Label.

    Reference https://developers.google.com/analytics/devguides/collection/analyticsjs/events https://www.seoworks.com/track-file-downloads-in-google-analytics-using-gtm/