Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Optionally Sending Analytics Event for allFlagsState call #292

Open
AleenaCodes opened this issue May 16, 2024 · 1 comment
Open

Optionally Sending Analytics Event for allFlagsState call #292

AleenaCodes opened this issue May 16, 2024 · 1 comment

Comments

@AleenaCodes
Copy link

Is your feature request related to a problem? Please describe.

I am using client.allFlagsState in my code to evaluate all the feature flags

However there are no live events generated from this evaluation, and I can see in the documentation that analytics are only sent on individual flag evaluations

The all flags method does not send analytics events to LaunchDarkly by default for most SDK

Describe the solution you'd like

Is there a way to turn analytics events on for these calls? I'm keen to be able to track these events in the dashboard and have new context values picked up

@kinyoklion
Copy link
Member

Hello @AleenaCodes,

As noted in the repository readme this package has been superseded by @launchdarkly/node-server-sdk. Development now happens in: https://github.com/launchdarkly/js-core

The package that is in this repository will be reaching its end-of-life soon, and will not be receiving anything aside from potentially critical updates.

For the question specifically.

Generally speaking analytics for all flags all the time doesn't allow for product features to work well. For instance if you always evaluate all flags, and doing so sends analytics events for all of the flags, then you cannot do things like know the audience exposed to an experiment. (Evaluating the single flag, at a point the user is actually exposed to the feature, does allow tracking that audience.)

The allFlagsState method is provided to allow for things like bootstrapping a client. The client gets all the flag values, so it can start rendering immediately with recent values, and it will then send its own analytics events as each of those flags is evaluated.

If you specifically want contexts associated with those evaluations to be populated, then you can use the identify method which will result in an analytic event being sent for the specific context specified.

There are some limited cases where it may make sense to send analytics events for all flags, for instance if you have a statically rendered site that exposes the user to all the features at all times.

In this case you can make variation calls for each of the returned flags.

Thank you,
Ryan

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants