Web analytics

Agile IT asked on July 3, 2017 12:25


I have custom content type which are used to create the downloadable files, whose one fields maps the file from media library or attachment. The content is created under a menu page and render in page as anchor tag with src to media or attachment file.

We have enabled the web analytics and other reports looks fine but file download is not tracking. I found this https://devnet.kentico.com/questions/how-to-track-all-downloads-in-the-analytics-module but I see there is changed in Kentico 10.

Also, we have Ajax based search used for smart search in frontend, that may be the reason "on-site search keywords" are also not tracked. Ajax based means we have normal textbox and when user enters text we do search on page which have search set and parsed the result back and append in main page.

What is the way to fix the tracking for both case?

Recent Answers

Trevor Fayas answered on July 5, 2017 19:33

If you are using custom logic for these items (or any resource that won't be able to load the analytics Javascript), you may need to track the Web Analytics through the API.

Look up CMS.WebAnalytics.AnalyticsHelper.LogIPVisit, and related methods there, see if that helps!

0 votesVote for this answer Mark as a Correct answer

Agile IT answered on July 6, 2017 11:39

Any example would be helpful or documentation on how this can used to track file downloads which are not CMS.File

0 votesVote for this answer Mark as a Correct answer

Trevor Fayas answered on July 6, 2017 15:20

Like i said,in order to track you'll need to feed the file through a custom page, and in that page call the CMS.WebAnalytics.AnalyticsHelper.LogIPVisit function.

If the files are in the media library, you can make a page that you pass the Media Library ID or GUID and thus track it that way, similar to how the /GetMedia pages work. If it's not in the media library, you would need to pass to a custom page the path or something.

Such as /GetFile.aspx?path=/MySite/media/myfiles/thefile.pdf and the GetFile.aspx hits the LogIPVisit, and then takes the path and gives the file.

Make sense?

If you have a lot of links to files and don't want to change them all, you can try to set up a URL Rewrite rule on IIS to find all /MySite/media urls and alter them to be the /GetFile.aspx?path=...

0 votesVote for this answer Mark as a Correct answer

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