Skip to content

Update trackingCallback with user argument - #112

Open
teresayung wants to merge 2 commits into
mainfrom
ty/update_tracking_callback_args
Open

Update trackingCallback with user argument#112
teresayung wants to merge 2 commits into
mainfrom
ty/update_tracking_callback_args

Conversation

@teresayung

Copy link
Copy Markdown

Forward user arg through the patched tracking callback

The content script's setTrackingCallback patch dropped the callback's third arg, so consumers got user === undefined. The SDK calls tracking callbacks with (experiment, result, user), where user is the attribute snapshot at evaluation time.

This updates the wrapper in embed_script.ts to accept and forward an optional user?: UserContext, and to include it in the object pushed to setDeferredTrackingCalls ({ experiment, result, user }). user is optional throughout, so it flows through safely as undefined when the page SDK doesn't supply one. isNoopCallback / originalParams handling is unchanged.

Preserving this exact arg matters because reading live attributes instead would drift for deferred tracking calls.

Note: the pinned SDK (1.6.5) predates the 3-arg signature, so a small local TrackingCallbackWithUser type and an as TrackingData cast are used to compile; both can be dropped once the SDK is bumped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant