How to track download file analytics in Kentico 7
Let say you create one Document Type in Kentico CMS, and inside the document type got one field for attachment. So you want to track/count how many time the document download using Web Analytic feature in Kentico.
First of all you need to enable the web analytic feature in Kentico. Follow this link to read more about web analytic in kentico.
Here is the solution to track/count download file for a DocumentType Field.
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 1268 or Find method LogEvent 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")))
Reference : Kentico Forum
By Mohd Zulkamal
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
First of all you need to enable the web analytic feature in Kentico. Follow this link to read more about web analytic in kentico.
Here is the solution to track/count download file for a DocumentType Field.
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 1268 or Find method LogEvent 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")))
Reference : Kentico Forum
By Mohd Zulkamal
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)