How to use the @shopgate/tracking-core/plugins/Base.formatData function in @shopgate/tracking-core

To help you get started, we’ve selected a few @shopgate/tracking-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github shopgate / pwa / extensions / @shopgate-tracking-ga-native / frontend / Plugin.js View on Github external
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;