There are many reasons why you might want to track a file download on your website as a Page in SiteCatalyst. I did it because I wanted to answer 2 main questions:
- Where do file downloads fit in the path users take prior to converting on my website?
- How do assets rank in terms of the role they play in driving conversion events? (Which assets are most-valuable in influencing future success events?)
The below implementation allows me to answer both of these questions fairly easy.
In your SiteCatalyst JavaScript code, you need to add the following utility function to your Plugins section (check to verify it doesn’t already exist):
/* Utility Function: p_gh */
s.downloadLinkHandler=new Function("p",""
+"var s=this,h=s.p_gh(),n='linkDownloadFileTypes',i,t;if(!h||(s.linkT"
+"ype&&(h||s.linkName)))return '';i=h.indexOf('?');t=s[n];s[n]=p?p:t;"
+"if(s.lt(h)=='d')s.linkType='d';else h='';s[n]=t;return h;");
Once called, the above function recognizes when a clicked link matches a download as specified in your list of download types (s.linkDownloadFileTypes). Now you’ll add the code to specify what to track when a file download is triggered; code will be added inside function s_doPlugins(s) {}:
var s_url=s.downloadLinkHandler();
if(s_url)
{
s.pageName='file|'+s_url.substr(s_url.search('.com')+5);
s.events="event28";
s.t();
}
In the above, note the following:
- s_url holds the full URL of the download link.
- s.pageName – In my example, I’m adding “file|” to the beginning of my s.pageName value, as well as using a few JS functions to only pull the URI of the link – everything after “.com” in my case. You could instead use a function to only pull the filename, or something else. The above works for me. Just note that you are limited to a certain number of characters for s.pageName.
- s.events – In my implementation, I track a file download as a success event.
- s.t() triggers the SiteCatalyst page view function.
- CAUTION: This implementation will also send all previously-populated variables on the page if they were not already cleared. For my purposes this was ideal, but you may need to clear variables you do not want populated w/ the download “page view”.
One final note…
I prefer to use Participation as my attribution method when comparing multiple pages and assets to see how they influence other events. Participation must be enabled on a per-event basis for the Pages report by ClientCare. Doing so allows you to answer #2, above. (To read more about Participation and the reasons for using this attribution method, see Adam Greco’s post on the Adobe blog.)