---
sourceDocument: Xanadu Employee Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/employee-service-management

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu Employee Service Management

ft:clusterId :

    - emplsm

bundleId :

    - emplsm

workflow :

    - Employee


---

# Add hotspots to track custom widget performance

# Add hotspots to track custom widget performance {#ariaid-title1}

* Release version: Xanadu
* 
* Updated October 24, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Hotspots help capture and log widget load times, which enables better debugging of long portal load times.

## Before you begin

Role required: sp_admin

## About this task

What are hotspots
:   Hotspots are specific areas of interest that help identify potential performance risks affecting portal load times, especially during high traffic. Logging hotspots allows users to monitor execution times for
    different processes and calls, including nested ones, to gain insights into what might be slowing down the user experience.

When do hotspots get logged?
:   Hotspots are logged when the admin enables performance metrics and impersonates a user. Records are only collected for that session and stored in the `sn_ex_emp_fd_portal_performance_stats`
    table.
:   To manage data volume, the system automatically deletes these records at the end of each week.

## Procedure

1. Navigate to AllService PortalWidget.
2. Click the custom widget you want to add the hotspot to.
3. Insert the following code snippets into the Server script field:  
   Define a start time below the loading configuration expression:

       var startTime = new GlideDateTime();

   Retrieve widget record number:

       var grInstanceRecord = $sp.getInstanceRecord();

   Retrieve widget instance identifier:

       data.spInstanceId =
                                   grInstanceRecord.getUniqueValue();

   Add load time tracking:

       new sn_cd.cd_Utils().postInstanceHotspot({
       				startTime: startTime,
       				callerId: data.spInstanceId,
       				shortDesc: '{enter name of widget}'
       		});

4. Click Update.

## What to do next

Open the Performance details window to view how long the custom widget takes to load data: [View widget performance metrics](https://servicenow-prod.fluidtopics.net/RXlSfNVhxL_CcwalcIum3w "View the metrics provided by the performance window to identify which widgets take the longest to load data.")

*[\>]: and then


