Report on how many times a piece of content has been downloaded
|Knowledge Article Number||000005326|
When you click on a content element, the Downloads tab lists who downloaded the content. Standard reporting capabilities do not provide this download history. To report on this feature, the API can be used to return the data.
The download history is stored in the ContentVersionHistory table.
To get the download histories, use the WHERE clause field=contentVersionDownloaded. The ContentVersionHistory.CreatedById field specifies who downloaded the file.
SELECT count(id) DownloadCountByUser, CreatedById FROM ContentVersionHistory WHERE CreatedDate = TODAY AND Field = 'contentVersionDownloaded' GROUP BY createdbyid
The following query can be used for Content Delivery download
The ContentVersionHistory table grows very quickly and performance will be a concern for any implementation. To improve performance, add restrictive criteria to the WHERE clause of a query. For instance, the sample query above, puts a time bound of TODAY; the query will perform relatively quickly on a large table because it's using the indexed CreatedDate field.