Skip to content

Conversation

@Blaumaus
Copy link
Member

@Blaumaus Blaumaus commented Dec 5, 2025

Depends on:

Summary by CodeRabbit

  • New Features
    • Added global profileId setting: Define a default profileId once that automatically applies to all pageviews and event tracking for consistent user identification across your application
    • Added profileId overrides: Override the global setting for specific events or pageviews to customize tracking on a per-interaction basis

✏️ Tip: You can customize this high-level summary in your review settings.

@Blaumaus Blaumaus self-assigned this Dec 5, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 5, 2025

Walkthrough

Extended the library's tracking capabilities by introducing global and per-call profileId options. The profileId is now configurable at the library level as a default and can be overridden at the event or pageview level, with proper propagation into both custom event and pageview payloads.

Changes

Cohort / File(s) Change Summary
Profile ID Tracking Enhancement
src/Lib.ts
Added global profileId option to LibOptions, per-call override in TrackEventOptions, and profileId field in IPageViewPayload. Implemented propagation logic to include profileId in custom event and pageview payloads, with event-level overrides taking precedence over global defaults.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Single file with focused, consistent changes across fields and payload propagation
  • Pattern reuse: identical override semantics applied to both events and pageviews (profileId ?? fallback)
  • Minor attention: verify null-coalescing logic is correctly applied in both custom event and pageview payload contexts

Poem

🐰 A profile ID hops along the way,
Through events and pageviews, tracking each day,
Global defaults dance with per-call overrides so neat,
Data propagates onward, making tracking complete! ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Profiles' is vague and does not clearly convey the specific changes made in the pull request, such as adding profileId options, per-call overrides, or payload propagation logic. Use a more descriptive title that captures the main change, such as 'Add profileId support to LibOptions and event tracking' or 'Implement per-call and global profileId options for events and pageviews'.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/profiles

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/Lib.ts (2)

36-40: LGTM! Consider privacy compliance.

The global profileId option is well-documented and correctly implemented. Since this enables long-term user tracking across sessions, ensure your privacy policy and consent mechanisms (GDPR, CCPA, etc.) appropriately disclose this capability to end users.


253-285: Verify whether error tracking should include profileId.

The submitError method does not propagate profileId (unlike track and submitPageView). If long-term user tracking includes associating errors with user profiles, consider adding:

 const errorPayload = {
   pg:
     this.activePage ||
     getPath({
       hash: this.pageViewsOptions?.hash,
       search: this.pageViewsOptions?.search,
     }),
   lc: getLocale(),
   tz: getTimezone(),
+  profileId: this.options?.profileId,
   ...payload,
 }

If error tracking is intentionally scoped out, this can be ignored.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 02ad5b8 and d87931c.

📒 Files selected for processing (1)
  • src/Lib.ts (5 hunks)
🔇 Additional comments (4)
src/Lib.ts (4)

55-56: LGTM!

The per-event profileId override is correctly typed and documented.


76-77: LGTM!

The per-pageview profileId override is correctly typed and documented, consistent with the event-level override.


309-309: LGTM!

The profileId propagation correctly implements the override behavior, with per-event values taking precedence over the global option.


441-442: LGTM!

The profileId is correctly propagated to pageview payloads. The object spread on line 442 ensures that any per-pageview profileId in payload will override the global default, matching the documented behavior.

@Blaumaus Blaumaus mentioned this pull request Dec 6, 2025
9 tasks
@Blaumaus Blaumaus changed the base branch from main to feature-flags December 9, 2025 00:29
@Blaumaus Blaumaus merged commit 2977579 into feature-flags Dec 9, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Dec 10, 2025
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