javascript-sdk
javascript-sdk copied to clipboard
Question: Omitting Impression Event on Activate When User Previously Activated
What I wanted to do
I'm have the understanding that every call to .activate that sends an impression via the events API by posting a decisions object within the visitors snapshots will result in my account being charged for an impression even though Optimizely dedupes the decisions table. Therefore, I've implemented logic inside a custom eventDispatcher.dispatchEvent function that adds experiment / variation metadata to local storage and on every activation call and subsequently checks all payloads in the event dispatcher call.
This is less than ideal and I don't think an onActivate event listener helps because it is just called when an activation event occurs but cannot block the actual activation. I'm wondering if there is an easier way with the SDK to prevent activation for a user that has been previously activated for a given experiment id and variation. I understand I could use getVariation for this type of thing but when using something like the React SDK where I don't have control over how the variation is retrieved I don't think that works?
What I expected to happen
Have an easy way via the SDK to avoid reactivating a previously activated user
What actually happened
Have to hack around in a custom event dispatcher which removes functionality such as the LocalStoragePendingEventsDispatcher and then parse through the visitors array to see if an activation event is included, and if so filter it out if the user has been previously activate.
@optimizely/[email protected]
@dtothefp Thanks for the suggestion.
To be honest, I'm going to have to discuss this in a stand-up meeting. Back with you by next week (latest).
cc @jaeopt
I've created a spike/research ticket (FSSDK-9619) for this Issue.