How to track all downloads in the analytics module

Technical support leader

Juraj Ondrus asked on December 13, 2011 06:17

How to track all downloads in the analytics module

Correct Answer

Juraj Ondrus answered on December 13, 2011 06:17

A bit of customization is required to track all the downloaded files. The problem is that only CMS.File document type downloads are tracked by default. However, you can change that by going to the file:

\CMSPages\GetFile.aspx.cs

Within this file, around line 451 there is the following condition:

if (IsLiveSite && (file.FileNode != null) && (file.FileNode.NodeClassName.ToLower() == "cms.file"))

You have to alter it to the following one so all files are logged, not only files attached to a CMS.File document:

if (IsLiveSite && (file.FileNode != null) )

You can also add only your document type, it's up to you:

if (IsLiveSite && (file.FileNode != null) && ((file.FileNode.NodeClassName.ToLower() == "cms.file")) II (file.FileNode.NodeClassName.ToLower() == "custom.documenttype")))

-bp-
0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.