How do I track who is accessing documents?
Hi there,
Is there anyway to trap an event in Sitefinity when someone accessing a document ?
I need to track users who are accessing documents without using Google analytics.
Ex: When user download a pdf document.
Thanks
S
There are two events fired when a library item is being downloaded/viewed. You might try and subscribe to them in the global.asax file and from there check the file and the user. If the two match your conditions, you could save the condition in a db table for your use later on.
protected void Application_Start(object sender, EventArgs e)
Bootstrapper.Initialized += new EventHandler<
Telerik.Sitefinity.Data.ExecutedEventArgs
>(Bootstrapper_Initialized);
Bootstrapper.Initializing += new EventHandler<
Telerik.Sitefinity.Data.ExecutingEventArgs
>(Bootstrapper_Initializing);
protected void Bootstrapper_Initialized(object sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
Telerik.Sitefinity.Services.EventHub.Subscribe<
Telerik.Sitefinity.Modules.Libraries.Web.Events.MediaContentDownloadedEvent
>(new Telerik.Sitefinity.Services.Events.SitefinityEventHandler<
Telerik.Sitefinity.Modules.Libraries.Web.Events.MediaContentDownloadedEvent
>(this.MediaDownloaded));
private void MediaDownloaded(Telerik.Sitefinity.Modules.Libraries.Web.Events.MediaContentDownloadedEvent mediaEvent)
throw new NotImplementedException();
I had to produce a report of which user has accessed what document and when. Because my requirements were a bit more involved, I did it through a UserControl droped on a page. It had no HTML so it was invisable, but the code would get executed behind the scenes when the page would load. Not nice but it did teh trick.
What Sitefinity version this valid for? 4.2 ?