Add event deduplication via optional id parameter#136
Merged
Conversation
Add optional `id:` keyword argument to `track` and `track_anonymous` for event deduplication. The id should be a ULID. No client-side validation — the API rejects invalid values. Fixes #107
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b930f2a. Configure here.
Allow passing timestamp: as a keyword arg to track and track_anonymous, alongside the existing id: keyword. The explicit keyword takes precedence over a timestamp in the attributes hash. Backwards compatible — existing callers that pass timestamp in attributes continue to work.
track() and track_anonymous() now accept id: and timestamp: keyword args. Callers must wrap attributes in explicit braces to avoid Ruby 3.x keyword argument ambiguity. Update all spec calls and README examples to use explicit hash syntax.
WebMock compares serialized JSON strings, so key order must match the insertion order in create_event (timestamp before id). Disable Metrics/ParameterLists on create_event — private method with keyword args, splitting would add complexity for no benefit.
washam-cio
approved these changes
May 7, 2026
7 tasks
This was referenced May 9, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
id:andtimestamp:keyword arguments totrackandtrack_anonymousfor event deduplication and explicit timestamp controlidshould be a ULID — no client-side validation, API rejects invalid valuesWithEventID()patternFixes #107. Replaces #108 and #85.
Adding keyword arguments to
trackandtrack_anonymousmeans callers using implicit hash syntax must add explicit braces:This is a semver-major change. All README examples updated.
Docs team: The Track API reference Ruby tab and any other docs showing
track()/track_anonymous()Ruby examples should be checked for implicit hash syntax.Test plan
idfield present in request body when providedidfield absent when not providedtimestampkeyword arg sets top-level timestamptimestampin attributes hash still works (backwards compat for that path)