Integrate Google Analytics with HCL Digital Experience
This section includes information set up integration of Digital Experience sites with Google Analytics and to view the resulting web analytics tracking to assess the effectiveness of your DX site pages with end user audiences.
Google Analytics provides ways for website owners to collect data on the visitors of their website, their activity and their interactions.
Complete the following steps to integrate Google Analytics to the HCL Digital Experience platform and to apply the integration to assess the effectiveness of DX sites with your target user audiences.
Installation
HCL Digital Experience utilizes the platform Active Site Analytics framework, which includes application scripts, called Aggregators, to collect page interactions data sent to external web analytics services for analysis. HCL DX administrators and page owners can manage the aggregators. They can assign an aggregator to one or more DX labels or pages.
In HCL DX 9.5 CF19 and higher, a new Active Site Analytics aggregator for Google Analytics is available.
Adding an Active Site Analytics aggregator to a DX site page
- Add the DX GoogleAnalyticsAggregator.js to the
HCL DX theme profile.In HCL DX 9.5 CF19 and higher, the GoogleAnalyticsAggregator.js file is located in the PortalServer_root/doc/js-samples directory.
- If using a WebDAV-based theme, copy the GoogleAnalyticsAggregator.js file to mycontenthandler/dav/fs-type1/theme/{your-custom-theme}/js.
- If using a WAR-based theme, include the GoogleAnalyticsAggregator.js file in the static theme WAR file.
For example, when using a WAR-based theme, the location of the GoogleAnalyticsAggregator.js file after installing to the <YourTheme> WAR file will be deployed under
wp_profile
:wp_profile/installedApps/<cell>/<YourTheme.ear>/<YourTheme.war>/themes/<YourTheme>/js
Refer to the file tree below how the custom theme app will be deployed:wp_profile ---> installedApps ---> <cell> ---> <YourTheme.ear> ---> <YourTheme.war> ---> themes ---> <YourTheme> ---> js ---> GoogleAnalyticsAggregator.js
- Add the DX GoogleAnalyticsAggregator.js to the
HCL DX theme profile.Note: The theme profile used by the page(s) needs to include
wp_analytics
or at leastwp_analytics_aggregator
.- HCL DX without Practitioner Studio installed:
- a. On Site Manager, select
- HCL DX 9.5 with Practitioner Studio installed:
- a. Select Manage Pages interface. to access the
Note: Child pages inherit the script that is set on the parent page. If you want to use a different aggregator on a child page, follow the same procedure that is previously addressed for the child page to make the appropriate assignment. If you want to block inheriting the aggregator setting from the parent page, follow the same procedure, but leave the value empty. As a result, the page has no aggregator that is assigned any longer, and all child pages of the parent page inherit the new setting. - Log in to your Google Analytics account and obtain the
GA_MEASUREMENT_ID
in your Google Analytics Dashboard. It is also referred to as Tracking ID.Example: - Add the following metadata in your target HCL DX page(s) properties:
asa_dependency
: https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_IDasa_aggregator
: GoogleAnalyticsAggregator.jsasa_js_ga_measurement_id
: GA_MEASUREMENT_ID
Example:Optionally, you can register the Active Site Analytics tags/microformats as custom dimensions or metrics in the Google Analytics Dashboard and configure the aggregator to use your custom map. See Google Analytics Custom Dimensions & Metrics.
For a list of Active Site Analytics tags associated with HCL DX site pages that can be tracked by the Google Analytics Aggregator, see How Active Site Analytics data is represented in the portal and Supported aggregator tags.
- Access the HCL Digital Experience site page analytics from Google
Analytics analyze HCL DX site activity.
After installing and configuring the aggregator to track analytics from specific HCL DX site pages using the steps above, DX content authors and site owners with access to Google Analytics can view the DX site activity tracked and reflected in Google Analytics Dashboard's real-time reports as an increase in the pageviews and active users.
See the following example:Refer to the Analytics tags and site promotions topics for more information on how to add additional tags and site promotions in addition to the out-of-the-box ones.
Using the Active Site Analytics Aggregator for Google Analytics to track DX deployment user sessions
Google Analytics can be used to track user session consumption in HCL Digital Experience deployments. A user session is defined as the number of web sessions or other online interactions, by anonymous or authenticated users interacting with a Digital Experience deployment, including API calls that deliver DX site content to users. A user session begins when a user authenticates with or visits a DX deployment and interacts with website pages and can include multiple website page views. By default, a user session ends when the user interaction with the DX deployment is idle for 30 minutes or until the user ends the interactions by explicitly closing their authentication or web page views session in the DX website. Refer to the Google Analytics documentation for additional information about How a web session is defined in Universal Analytics.
Using integration with Google Analytics and Digital Experience deployments, user session tracking is configured through the use of tags with scripts that track the page view requests for each website.
After completing the previous integration steps with the Active Site Analytics Aggregator for Google Analytics and your target DX deployments, you can use Google Analytics dashboards to view the user sessions data.
Google Analytics Dashboards
Refer to the Google Analytics documentation for additional information about Google Dashboards.
View user sessions data for Digital Experience deployment
Configuration options for the HCL DX Google Analytics Aggregator
asa_dependency
) by adding the following ‘opt-out’ metadata
in to the DX page(s)
properties:asa_js_ga.optout: true
window['ga-disable-GA_MEASUREMENT_ID'] = true
See Disable Google Analytics measurement for additional information.