SUI-Components/sui

[sui-pde] avoid tracking Experiment Viewed on feature flags

alextremp opened this issue · 0 comments

Package

pde

Description

Currently when we request for a feature flag to be active or not, if the user was not assigned to an optimizely response, we always track to Segment the Experiment Viewed event.

We have a request to avoid that as much as we can to avoid consuming Segment API Calls when there's no analytic interest on the feature flags.

As a proposal, and following a previous open issue to use structured args in useFeature ( #1418 ), we should add an additional arg to the useFeature:

  • track: Boolean, false by default. Setting it to true would mean there is a specific analytic interest on a feature flag and it should track the Experiment Viewed event. Letting it to false, it should not track the event to Segment.

Note that this would mean to push a Major version or send a clear notification about the change to current PDE users as the default tracking behavior will change.

Expected behavior: Only track the Experiment Viewed events to Segment if the new track parameter is explicitly set to true into the useFeature parameters

Actual behavior: Experiment Viewed events are always tracked to Segment