AI OnAI Off
Hi Dileep,
To track views of PDFs, I think you'll need to call some custom tracking (as described here: https://world.episerver.com/documentation/developer-guides/tracking/custom-tracking/) when the PDF is requested. Assuming you have a content type to represent your PDF files, you could create a handler for that type and then call the tracking from that so that the tracking is called each time someone requests a PDF. Something like this:
[TemplateDescriptor(Inherited = true, TemplateTypeCategory = TemplateTypeCategories.HttpHandler, Default = true)]
public class PdfBlobHttpHandler : BlobHttpHandler, IRenderTemplate<MyPdfFileType>
{
protected override Blob GetBlob(HttpContextBase httpContext)
{
var trackingService = ServiceLocator.Current.GetInstance<ITrackingService>();
//Add custom tracking here
//Load and return the file data
var routeHelper = ServiceLocator.Current.GetInstance<IContentRouteHelper>();
var binaryStorable = routeHelper.Content as IBinaryStorable;
return binaryStorable?.BinaryData;
}
}
You could of course also do client side tracking to some controller you manage on click and delay before letting the PDF navigation through. Similar to how you usually set it up in Google Tag Manager.
I am using EpiServer profile store to track page views which is all good. How would i go about tracking PDF's and its downloads using the profile store.