Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.register.pageview((data, raw) => {
const formattedData = SgTrackingPlugin.formatData('viewContent', raw);
if (!this.isMerchant || !formattedData.id) {
formattedData.id = formattedData.type;
}
// Some more sanitization
const specialTypes = [
'cart',
'favourite_list',
];
if (specialTypes.indexOf(formattedData.type) > -1) {
formattedData.id = this.isMerchant ? data.page.merchantUrl : data.page.shopgateUrl;
}
this.appHandler.viewContent(formattedData, this.cmdParams);
return false;