Print this page

Report on how many times a piece of content has been downloaded

Knowledge Article Number 000005326
Description

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.

Resolution

The download history is stored in the ContentVersionHistory table.
Developer documentation for ContentVersionHistory

To get the download histories, use the WHERE clause field=contentVersionDownloaded. The ContentVersionHistory.CreatedById field specifies who downloaded the file.

The following is a sample query that gets the count of today's number of downloads, per user:

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

Select DistributionId, createddate, IsDownload, Isinternal, ParentviewID From ContentDistributionView where Createddate is today

Performance Note:

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.





promote demote