Skip to main content
Gainsight Inc.

Exclude and Mask Tracked Data

This article explains how Gainsight PX can be set to exclude and mask tracked data.

Overview

Gainsight PX tracks button clicks, link clicks, and page views automatically. If your app is using GET calls and passes tokens as part of the URL, Gainsight PX can be set to exclude or mask URL or parameters without losing those events. You can exclude an entire URL or specific parameters by entering the values into the respectiive fields. 

To use the advanced SDK settings to select any level of excluding or masking options, navigate to Administration > SDK Settings

You can also hard code the configuration on the javascript snippet if you do not wish to rely on server-side settings that are propagated to the client.

Exclude or Mask URLs

To mask or exclude URLs from tracking, in the SDK Settings page, navigate to the Tracking section.

SDK Settings>Tracking.png

  • Mask URLs: In the URLs to mask from tracking field, enter the relevant URLs to be masked with or without wildcards.
  • Exclude URLs: In the URLs to exclude from tracking field, enter the the relevant URLs with or without wildcards.
var config = {    

    // Masking URLs    
    filterUrls : ["*app2/index1.html*", "*app2/buttons.html*"], 
    filterType : "mask"
    
    // Excluding URLs    
    excludeUrls : ["*app2/index1.html*", "*app2/buttons.html*"]
};

Exclude or Mask Query Parameters

If you like to benefit from more advanced tracking but without exposing sensitive parameters - use the named parameter filter. This filter will apply to ALL URLs

  • Set the relevant param names.
  • set filter type to 'mask'/'exclude'.
var config = {    

    // query parameter filters example    
    namedParamFilter : ["internalID"],    
    nameParamFilterType : "exclude" // "exclude" OR "mask"
};

Configure the tag with Security Filters Example

// ---- create the relevant config: ---- //
var config = {         // url filters example
	
	filterUrls : ["*app2/index1.html*", "*app2/buttons.html*"], // list of URLs to filter or exclude
	filterType : "mask", // "exclude" OR "mask"
	
	// query parameter filters example    
	namedParamFilter : ["internalID"],
	nameParamFilterType : "exclude" // "exclude" OR "mask"
};

// ---- pass the config to the tag: ---- //
(function(n,t,a,e,x){var i="aptrinsic";n[i]=n[i]||function(){
	(n[i].q=n[i].q||[]).push(arguments)},n[i].p=e;n[i].c=x;
	var r=t.createElement("script");r.async=!0,r.src=a+"?a="+e;
	var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(r,c)
})(window,document,"https://web-sdk.aptrinsic.com/api/aptrinsic.js", "AP-USE-YOU-REAL-TAG-PLEASE-DO-NOT-COPY-PASTE-2", config);

URL Masking Function

If you want total control over the URL that is sent to PX, you can supply a Javascript function that optionally modifies any URL before it is sent to the PX servers. The function must take one argument and return that argument with any modifications made to the members of that object. There is no validation done on the returned values.

Example:

var config = {
              filterUrls: ["*"],
              maskUrlFunction: (urlPayload, mode) =>
                    {
                     urlPayload.url = urlPayload.url && urlPayload.url.replace("secret", "xxx");
                     return urlPayload;
                     }
             }

The mode parameter indicates when the masking function is being applied.

Possible values are:

  • rule - Called during a product mapping operation in the product editor
  • track - Called during a real-time tracking event

The URL Payload parameter is an object with the following fields:

{
    url : 'full URL string', // will be undefined only when path is set
    path: 'URL path', // can be undefined
    title: 'page title', // can be undefined
    referrer: 'full referrer URL string' // can be undefined
}​​ 

Note: In the case when the URL being masked is a relative URL and consists only of a path, the URL field will be undefined and the path field will contain the relative URL value.