Count the number of times an article was viewed by internal users
|Knowledge Article Number||000213018|
|Description||Admins might want to know certain statistics about articles on how many views it got internally or externally so that they can decide to archive or keep certain articles.
|Resolution||There is a class in Salesforce called KnowledgeArticleViewStat which can be used for accessing certain statistics related to the article views like the NormalizedScore and the ViewCount.
Viewcount gives the number of unique views an article has received in the selected channel.
A Channel is where the article is viewed:
AllChannels for article views across all channels.
App for the internal Salesforce Knowledge application.
Pkb for article views in public knowledge base.
Csp for Customer Portal.
Prm for article view in partner portal.
So say, you want to count the number of article views by internal users,
We can use the channel App since it meant for the internal Salesforce Knowledge application.
You can do a SOQL query as following:
SELECT id, ViewCount from KnowledgeArticleViewStat where Channel = 'App'