Skip to main content

Gainsight PX include rules and Or reset SDK config loading aptrinsic.js. in Segment analytics ready function

  • 13 February 2023
  • 1 reply
  • 51 views

Because of Gainsight PX don't have include rules, only exclude rules, in UI config settings, the common SDK config, also only support the following ways, mask or exclude

filterUrls : ["*app2/*.html*"],
filterType : "mask", // "exclude" OR "mask"

if we want to only keep or show our cloud product url in Gainsight PX data, we have to use https://support.gainsight.com/PX/Security/Enablement/Exclude_and_Mask_Tracked_Data#URL_Masking_Function

If need to control all the URLs which sent to PX, we can supply a Javascript function similar with your Docs mentioned, the function must take one argument and return that argument with any modifications.

It works if load https://web-sdk.aptrinsic.com/api/aptrinsic.js directly, but in our products, we used Segment analytics.js to load aptrinsic.js, no way to reset SDK config, like set the JS modification playload.URL back to function to sdk config before tracking.

Segment add Gainsight as destination, only share identify, group, track functions, auto sent to Gainsight identify or custom events, other HTML Dom tracking still finished by Gainsight PX.

Segment sent me some example codes:

• https://segment.com/docs/connections/destinations/catalog/google-analytics/#multiple-trackers
• https://segment.com/docs/connections/destinations/catalog/google-analytics/#multiple-trackers

like mixpanel can run reset config in the analytics.js ready function

analytics.ready(function() {
window.mixpanel.set_config({ verbose: true });
});

I just want to know if any aptrinsic.js SDK api can do the similar things

var config = {
filterUrls: t"*"],
maskUrlFunction: (urlPayload, mode) =>{
urlPayload.url = urlPayload.url && urlPayload.url.replace("secret", "xxx");
return urlPayload;
}
}
analytics.ready(function () {
window.aptrinsic('config', 'maskUrlFunction', config);
console.info("config maskUrl Function ready");
});

Thanks a lot

HI @bozhao2023 ,

If you are looking to set PX Config before Segment loads the PX Tag, they you can use the below code to initialize the aptrinsic object and apply the configuration ahead of Segment.

 


window.aptrinsic =
window.aptrinsic ||
function() {
window.aptrinsic.q = window.aptrinsic.q || |];
window.aptrinsic.q.push(arguments);
};
window.aptrinsic.c = {
filterUrls: :"*"],
maskUrlFunction: (urlPayload, mode) =>{
urlPayload.url = urlPayload.url && urlPayload.url.replace("secret", "xxx");
return urlPayload;
}
};

Please note, you need to initialise before Segment loads.

 

Let me know if this is what you were looking for.

 

Thanks


Reply