Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Understanding how knowledge article views are counted

Ro5
Tera Expert

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

1 ACCEPTED SOLUTION

Harish KM
Kilo Patron
Kilo Patron

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
}

Regards
Harish

View solution in original post

7 REPLIES 7

Hi May i know which knowledge article content widget are you using? You need to check OOB wigdet "knowledge Article Content" . 

Attached script include screenshot

Regards
Harish

My script include didn't have that function.

find_real_file.png

Below is the OOB wigdet I use.

okay I think your not in Sandiego version in that case in your widget HTML look for data.view // this is what will get the count in HTML and in server script look for the line data.view  and check from where it is getting the view count

Regards
Harish