How to create a report with number of users who accessed the portal site's "FAQ" page

jasoncao
Tera Contributor

Hello,
I have a question : How can I create a trend report with 
Vertical axis: Number of users who accessed the portal site's "FAQ" page
Horizontal axis: Month
Thanks!

1 REPLY 1

Astik Thombare
Tera Sage

Hi @jasoncao ,

 

To create a trend report in ServiceNow with the vertical axis representing the number of users who accessed the portal site's "FAQ" page and the horizontal axis representing months, you can follow these general steps:

 

1. Prepare Your Data Source


Before creating the report, ensure you have a way to capture the data about users accessing the "FAQ" page. This might involve logging page accesses or using some analytics tool that integrates with ServiceNow.

 

2. Create a Scripted Metric in ServiceNow


Since ServiceNow might not directly track user-specific page accesses out-of-the-box, you may need to create a scripted metric to count accesses to the "FAQ" page. Here's a simplified example of how you might approach this:

 

Navigate to Performance Analytics > Create a Metric.

 

Choose Scripted as the type of metric.


Write a script to count the number of times users accessed the "FAQ" page per month. This could involve querying log records, user sessions, or any other data source where you log page visits.


Example script (assuming you have a table where page visits are logged):

 

 

 

 

 

(function() {
    var answerMetric = new GlideAggregate('your_access_log_table');
    answerMetric.addEncodedQuery('page_name=' + encodeURIComponent('FAQ'));
    answerMetric.addAggregate('COUNT');
    answerMetric.groupBy('MONTH');  // Assuming there's a date field to group by month

    var counts = {};
    answerMetric.query();
    while (answerMetric.next()) {
        var month = answerMetric.getValue('MONTH');
        var count = answerMetric.getAggregate('COUNT');
        counts[month] = count;
    }

    return counts;
})();

 

 

 

 

 

Replace your_access_log_table with the actual table where page accesses are logged, and adjust the page_name and date field (MONTH) based on your actual data structure.

 


3. Create an Indicator


Once you have the script to count accesses per month, create an indicator based on this script.

 

Navigate to Performance Analytics > Indicators.


Create a new indicator and select Scripted as the source.


Paste your script into the indicator's script field.

 

4. Create a Breakdown


Create a breakdown to define the breakdown type (e.g., by month).

 

Navigate to Performance Analytics > Breakdowns.


Create a new breakdown and define the breakdown type (e.g., by month).

 

5. Create a Report


Now that you have your indicator and breakdown, you can create a trend report.

 

Navigate to Reports > New Report.


Choose the type of report (e.g., trend report).

 

Configure the report:

Vertical axis: Select your indicator (number of users accessing "FAQ").
Horizontal axis: Select your breakdown (month).


Set any additional filters or parameters as needed

 

6. Save and View Your Report


Save the report and view it to ensure it displays the trend of users accessing the "FAQ" page over months.

 

By following these steps, you can create a trend report in ServiceNow that tracks the number of users accessing the portal site's "FAQ" page over different months. Adjustments may be necessary based on your specific data model and reporting needs.

 

    If my reply helped with your issue please mark helpful 👍 and correct ✔️ if your issue is resolved.

 

                         By doing so you help other community members find resolved questions which may relate to an issue they're having

 

 

Thanks,

Astik