Home > widget-integration > FilterService > setActionLocalStorage

FilterService.setActionLocalStorage() method

Sets the action type in localStorage for analytics tracking.

Stores the most recent action type (filter, search, suggest) to localStorage. Used by analytics to determine the source of user interactions with products.

Signature:

setActionLocalStorage(action: "filter" | "search" | "suggest"): void;

Parameters

Parameter

Type

Description

action

"filter" | "search" | "suggest"

The action type ('filter', 'search', 'suggest')

Returns:

void

Remarks

This value is read by product click handlers and add-to-cart events to attribute conversions to the correct source.

Example

Override to add custom action tracking:

setActionLocalStorage(action) {
  super.setActionLocalStorage(action);
  // Track action changes for funnel analysis
  this.analytics.track('user_action_changed', {
    previousAction: this.getPreviousAction(),
    newAction: action
  });
}