- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 10:32 PM
hello.
Regarding the number of views counted when reading a knowledge article, I would like to customize it as follows.
・Do not count up the number of views when the browser is updated.
・Do not count up when a user with a specific role browses.
Where should I customize?
Thank you.
Ro
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 11:37 PM
Sorry forgot to mention widget part. If you look at Knowledge article content widget in server script the below line
// this function is called by script include KBViewModel and function KBViewModel. So you need to find a way to modify here
function handleViewCountIncrement(){
var incrementedViewCount = new global.KBViewModel().KBViewModel(knowledgeRecord);
if(incrementedViewCount)
data.viewCount = parseInt(incrementedViewCount); // this is the count shown on article widget called in HTML part
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 10:47 PM
Hi you need to check script include KBViewModelSNC in this there is a below function which does this
increaseKBView: function(knowledgeRecord) {
if (!this.isPreviewArticle() && knowledgeRecord && knowledgeRecord.isValid()){
knowledgeRecord.incrementViewCount();
new sn_ais.IndexEvent().queueUpdatableFieldAction('kb_knowledge', knowledgeRecord.getUniqueValue());
}
},
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 10:50 PM
Can you also let us know what didn't work from the links provided to you on your duplicate question? That helps when providing the answer you are looking for (even better if you would just update that question with that info, so everyone would know what information you already have). Can you close the duplicate one?
If my answer helped you in any way, please then mark it as helpful.
Mark
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2022 11:37 PM
Sorry forgot to mention widget part. If you look at Knowledge article content widget in server script the below line
// this function is called by script include KBViewModel and function KBViewModel. So you need to find a way to modify here
function handleViewCountIncrement(){
var incrementedViewCount = new global.KBViewModel().KBViewModel(knowledgeRecord);
if(incrementedViewCount)
data.viewCount = parseInt(incrementedViewCount); // this is the count shown on article widget called in HTML part
}
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2022 01:33 AM
hello. Harish KM
Thank you for your reply.
When I checked, the script include did not have the following functions.
increaseKBView: function(knowledgeRecord) {
if (!this.isPreviewArticle() && knowledgeRecord && knowledgeRecord.isValid()){
knowledgeRecord.incrementViewCount();
new sn_ais.IndexEvent().queueUpdatableFieldAction('kb_knowledge', knowledgeRecord.getUniqueValue());
}
},
When I checked the actual knowledge article screen, the number of views was not displayed.
Is it because my settings are wrong?
Thank you.
Ro
