Home > widget-integration > API_ACTION_TYPE

API_ACTION_TYPE variable

API action types for different filter widget operations.

Categorizes the type of API request being made for analytics and routing.

Signature:

API_ACTION_TYPE: {
	readonly SEARCH: "search";
	readonly FILTER: "filter";
	readonly SUGGEST: "suggest";
}

Remarks

Used to track user actions in analytics platforms and to route requests to appropriate API endpoints. Technical Support teams can use these values when implementing custom analytics tracking.

Example

Track action types in analytics:

window.boostWidgetIntegration.extend('FilterAPI', (FilterAPI) => {
  return class extends FilterAPI {
    async getProductByFilter(params, additions) {
      // Track filter action
      if (window.gtag && additions.actionType === API_ACTION_TYPE.FILTER) {
        window.gtag('event', 'filter_applied', {
          filters: Object.keys(params).filter(k => k.startsWith('pf_'))
        });
      }
      return super.getProductByFilter(params, additions);
    }
  };
});