fix: Allow timestamp override for experiment events #1317
Merged
+99
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This fix will allow experiment events to override the default timestamp provided by the Analytics SDK. This will allow the timestamp of experiment events to reflect the time of exposure, rather than when the event is processed by the Analytics SDK.
Relevant
experiment-tag
PR.Checklist
Note
Event bridge now extracts
time
fromeventProperties
and passes it asEventOptions.time
totrack
, omitting it from properties.packages/analytics-browser/src/browser-client.ts
):time
fromevent.eventProperties
.{ time }
as third argument totrack
when numeric.time
from forwardedeventProperties
and default to{}
when absent.packages/analytics-browser/test/browser-client.test.ts
):time
ineventProperties
(passed via options).null
time
(ignored; optionsundefined
).eventProperties
(defaults to{}
, optionsundefined
).Written by Cursor Bugbot for commit cc58b8f. This will update automatically on new commits. Configure here.