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.

How to Dynamically Track Knowledge Article View Origins

Anil Karthik N
Tera Contributor

Hi All,

I have a requirement to track the origin of knowledge article views dynamically in the kb_use table.

Key aspects of the requirement:

  1. The origin should include every possible location (e.g., Virtual Agent, Workspaces, HRSS My IT, Now Mobile, etc.) without requiring manual updates whenever a new location is added.
  2. Existing records in the kb_use table should also be classified retroactively based on this new field.

Has anyone achieved a similiar solution. How can I achieve this?

 

Thanks in Advance

Anil Nuthakki

2 REPLIES 2

larralapid
Tera Guru

To dynamically track Knowledge Article view origins (e.g., who viewed it and from where), use a combination of:

 


 

 

1.

Knowledge Use table (kb_use)

 

 

ServiceNow automatically logs views in the kb_use table, which includes:

 

  • user

  • knowledge (article reference)

  • date

  • view_source (can be extended)

 

 

📍Navigate to: Knowledge > Administration > Article Views

 


 

 

2.

Capture Source Context

 

 

To track the origin (referrer) such as Case, Incident, or Virtual Agent:

 

 

Option A:

Extend the view_source field

 

 

Add logic to populate the source when article is opened:

 

  • If article opened via sn_customerservice_case, populate view_source = "Case"

  • If via VA dialog, set it to "Virtual Agent"

 

 

Use a Business Rule or Script Include tied to the view logic.

 

 

Option B:

Pass source via URL parameter

 

 

When linking to the article, append:

?view_source=case

Then write a UI Script or use Client Scripts to log that value to kb_use.

 


 

 

3.

Reporting on Views

 

 

Create reports from kb_use, grouped by:

 

  • Article

  • User

  • Source (if tracked)

  • Date

 

 

This gives full audit capability of what was viewed, by whom, and via which channel.

 

view_use field is not available on kb_use table

Can you suggest any other way?