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 the parameters without losing those events.
Use the advanced SDK settings to select any level of excluding or masking options. You can exclude an entire URL or specific parameters by entering the values into the exclude/mask URLs and parameters section.
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 URLs
To exclude URLs and prevent these URLs to be tracked:
- Set the relevant URLs with/out wildcards.
- Set filter type to 'exclude'.
var config = { // url filters example filterUrls : ["*app2/index1.html*", "*app2/buttons.html*"], // list of URLs to filter or exclude filterType : "exclude"};
Mask URLs
To mask URLs - set the filter type to 'mask' - it will override the tracked URL to apt-maksed-url.
- Set the relevant URLs with/out wildcards.
- Set filter type to 'mask'.
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 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.