Set up Content Analytics tracking
To use Content Analytics with custom pages or widgets, add the tracking profile to your Employee Center or service portal theme header and add the cdaAnalytics service to your custom widgets.
Before you begin
Role required: sn_cda.analytics_admin
About this task
More steps for page tracking:
Add the tracking profile to your Employee Center or service portal theme header.
<widgetid="cda-site-analytics"options="{ 'tracking_profile_name': '{PROFILE_NAME}', 'enable_logging': false}"></widget>Note: If you don’t specify a tracking profile in the options, content analytics tries to use the default tracking profile. See Create a Content Analytics tracking profile.
Procedure
-
Navigate to All > Service Portal > Headers & Footers.
-
Select your header (Content Publishing Header, Employee Center Header, ESC Header, or HRMadrid Header).
-
If necessary, clone the header.
For more information, see Service Portal configuration page. Or, you can use Angular Providers, see Reuse components with Angular Providers.
-
If using a clone from the Content Publishing header, search for the cda-site-analytics widget tag in the Body HTML template field.
-
Then replace PROFILE_NAME with the profile that you want to use for tracking.
For more information, see Configure a portal header menu.
-
If you’re using a different header, add the following to the Body HTML and replace PROFILE_NAME:
XML<widgetid="cda-site-analytics"options="{ 'tracking_profile_name': '{PROFILE_NAME}', 'enable_logging': false}"></widget>If you don’t specify a tracking profile in the widget options, content analytics tries to use the default tracking profile (if it exists).
Track Employee Center events
To track Employee Center events, add the cdaAnalytics service to your custom widgets. See Widget developer guide.
For example:
JavaScriptfunction ($scope, cdaAnalytics) {$scope.onButtonClick = function() { // track event using the default tracker (no argument for getTracker)cdaAnalytics.getTracker() .then(function(tracker) {tracker.trackEvent('{Desired Category}','{Desired Action}','{Desired Name}');}); // track event using specific trackercdaAnalytics.getTracker ('Human Resources Portal Tracker').then(function (tracker) {tracker.trackEvent('Human Resources','Video Viewed','Open Enrollment 2018');});};} -
Navigate to Service Portal > Widgets.
-
Select a widget or create one.
-
Add cdaAnalytics to the Related List of Angular Providers.
-
Update the client controller of the widget to use the cdaAnalytics service.
---
title: Set up Content Analytics tracking
description: To use Content Analytics with custom pages or widgets, add the tracking profile to your Employee Center or service portal theme header and add the cdaAnalytics service to your custom widgets.
locale: en-US
canonical_url: https://www.servicenow.com/docs/r/employee-service-management/employee-experience-foundation/ecpro-content-analytics-tracking-setup.html
release: brazil
product: Employee Experience Foundation
classification: employee-experience-foundation
topic_type: task
last_updated: "2026-09-10"
reading_time_minutes: 1
breadcrumb: [Content Analytics, Setup continuous improvement, Configuring Employee Center Pro, Employee Center Pro, EmployeeWorks, Employee Service Management]
---
# Set up Content Analytics tracking
To use Content Analytics with custom pages or widgets, add the tracking profile to your Employee Center or service portal theme header and add the cdaAnalytics service to your custom widgets.
## Before you begin
Role required: sn\_cda.analytics\_admin
## About this task
More steps for page tracking:
Add the tracking profile to your Employee Center or service portal theme header.
```
<widget
id="cda-site-analytics"
options="{ 'tracking_profile_name': '{PROFILE_NAME}', 'enable_logging': false}"
></widget>
```
**Note:** If you don’t specify a tracking profile in the options, content analytics tries to use the default tracking profile. See [Create a Content Analytics tracking profile](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/employee-service-management/employee-experience-foundation/ecpro-content-analytics-setup.md).
## Procedure
1. Navigate to **All** > **Service Portal** > **Headers & Footers**.
2. Select your header \(Content Publishing Header, Employee Center Header, ESC Header, or HRMadrid Header\).
3. If necessary, clone the header.
For more information, see [Service Portal configuration page](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/platform-user-interface/service-portal-configuration-page.md). Or, you can use Angular Providers, see [Reuse components with Angular Providers](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/platform-user-interface/angular-providers.md).
4. If using a clone from the Content Publishing header, search for the cda-site-analytics widget tag in the **Body HTML template** field.
5. Then replace PROFILE\_NAME with the profile that you want to use for tracking.
For more information, see [Configure a portal header menu](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/platform-user-interface/configure-header-menu.md).
6. If you’re using a different header, add the following to the Body HTML and replace PROFILE\_NAME:
```
<widget
id="cda-site-analytics"
options="{ 'tracking_profile_name': '{PROFILE_NAME}', 'enable_logging': false}"
></widget>
```
If you don’t specify a tracking profile in the widget options, content analytics tries to use the default tracking profile \(if it exists\).
Track Employee Center events
To track Employee Center events, add the cdaAnalytics service to your custom widgets. See [Widget developer guide](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/brazil/markdown/platform-user-interface/widget-dev-guide.md).
For example:
```
function ($scope, cdaAnalytics) {
$scope.onButtonClick = function() {
// track event using the default tracker (no argument for getTracker)
cdaAnalytics.getTracker() .then(function(tracker) {
tracker.trackEvent(
'{Desired Category}',
'{Desired Action}',
'{Desired Name}'
);
});
// track event using specific tracker
cdaAnalytics.getTracker ('Human Resources Portal Tracker').then(function (tracker) {
tracker.trackEvent(
'Human Resources',
'Video Viewed',
'Open Enrollment 2018'
);
});
};
}
```
7. Navigate to **Service Portal** > **Widgets**.
8. Select a widget or create one.
9. Add cdaAnalytics to the Related List of Angular Providers.
10. Update the client controller of the widget to use the cdaAnalytics service.
| title | Set up Content Analytics tracking |
| description | To use Content Analytics with custom pages or widgets, add the tracking profile to your Employee Center or service portal theme header and add the cdaAnalytics service to your custom widgets. |
| locale | en-US |
| canonical_url | https://www.servicenow.com/docs/r/employee-service-management/employee-experience-foundation/ecpro-content-analytics-tracking-setup.html |
| release | brazil |
| product | Employee Experience Foundation |
| classification | employee-experience-foundation |
| topic_type | task |
| last_updated | 2026-09-10 |
| reading_time_minutes | 1 |
| breadcrumb | Content AnalyticsSetup continuous improvementConfiguring Employee Center ProEmployee Center ProEmployeeWorksEmployee Service Management |