Skip to content

Conversation

tyiuhc
Copy link
Contributor

@tyiuhc tyiuhc commented Oct 2, 2025

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

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

Note

Event bridge now extracts time from eventProperties and passes it as EventOptions.time to track, omitting it from properties.

  • Browser Client (packages/analytics-browser/src/browser-client.ts):
    • Update event bridge receiver to:
      • Extract time from event.eventProperties.
      • Pass { time } as third argument to track when numeric.
      • Omit time from forwarded eventProperties and default to {} when absent.
  • Tests (packages/analytics-browser/test/browser-client.test.ts):
    • Add tests for event bridge handling of:
      • Numeric time in eventProperties (passed via options).
      • null time (ignored; options undefined).
      • Missing eventProperties (defaults to {}, options undefined).

Written by Cursor Bugbot for commit cc58b8f. This will update automatically on new commits. Configure here.

@Mercy811
Copy link
Contributor

Mercy811 commented Oct 3, 2025

bugbot run

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no bugs!


Comment @cursor review or bugbot run to trigger another review on this PR

Copy link
Contributor

@Mercy811 Mercy811 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ExposureTrackingProvider.track(exposure: Exposure) takes Exposure which is not amplitude event but just event properties. So it makes sense to track time as an event property and convert it to event option.

@tyiuhc tyiuhc merged commit 055b998 into main Oct 6, 2025
11 of 12 checks passed
@tyiuhc tyiuhc deleted the experiment-time-override branch October 6, 2025 18:55
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.

2 participants