Skip to content

added deduplication event in docs - #37

Open
ChetanBhosale wants to merge 6 commits into
mainfrom
doc_event_id
Open

added deduplication event in docs#37
ChetanBhosale wants to merge 6 commits into
mainfrom
doc_event_id

Conversation

@ChetanBhosale

@ChetanBhosale ChetanBhosale commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • SDKs (iOS, Android, Flutter, React Native) and Event Capture API now accept an optional event ID to enable unique event identification and server-side deduplication.
  • Documentation

    • Updated API and SDK docs with examples showing how to include event IDs (UUID recommended), guidance for cross-source deduplication, and aligned revenue/amount guidance in examples.

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

@coderabbitai

coderabbitai Bot commented Jan 14, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Added optional event identifier (eventId / event_id) to API reference and SDK examples across platforms, with example UUID generation and a note recommending unique IDs for server-side deduplication and cross-source consistency. Changes are documentation and example updates; minimal public API surface notes where shown.

Changes

Cohort / File(s) Summary
API docs
api-reference/event-capture.mdx
Added optional event_id field to request payload examples and parameter table; added a note on uniqueness and server-side deduplication; updated example payloads.
Flutter SDK docs
sdk/flutter/usage.mdx, sdk/flutter.mdx
New comprehensive Flutter usage doc and updated examples to include optional eventId parameter and Uuid().v4() usage; added notes on deduplication and event/revenue flows.
Android SDK docs
sdk/android.mdx
Updated examples to pass eventId (e.g., UUID.randomUUID().toString()); added explanatory note about uniqueness and cross-source deduplication.
iOS SDK docs
sdk/ios.mdx
Added optional eventId parameter to Swift examples (imports/usage) and a Note about server-side deduplication; example calls updated to include UUID().uuidString.
React Native SDK docs
sdk/react-native.mdx
Updated trackEvent examples to accept eventId (e.g., uuidv4()), adjusted purchase/revenue examples, and added a deduplication note; usage signature in docs updated.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I hopped through docs with whiskers bright,

Gave each event a tiny light,
UUIDs tucked in every call,
Servers now catch duplicates all,
Hooray — events stand tall!


🧹 Recent nitpick comments
sdk/android.mdx (1)

338-356: Documentation looks good, but consider varying example UUIDs or showing generation.

The eventId parameter documentation is clear and the Note explaining deduplication is helpful. However, using the same hardcoded UUID (550e8400-e29b-41d4-a716-446655440000) in multiple examples might mislead developers into thinking they can reuse the same ID. Consider either:

  1. Showing how to generate a UUID (e.g., UUID.randomUUID().toString())
  2. Using different example UUIDs in different snippets to emphasize uniqueness
💡 Suggested improvement for the first example
+import java.util.UUID
+
 val result = LinkRunner.getInstance().trackEvent(
     eventName = "purchase_initiated",
     eventData = mapOf(
         "product_id" to "12345",
         "category" to "electronics",
         "amount" to 99.99
     ),
-    eventId = "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication
+    eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String) for deduplication
 )
sdk/flutter/usage.mdx (1)

163-183: Good documentation for Flutter eventId usage.

The tracking custom events section clearly documents the optional eventId parameter with a helpful Note about deduplication. Consider showing Dart UUID generation (e.g., using the uuid package) instead of a hardcoded value to better illustrate the uniqueness requirement.

💡 Optional: Show UUID generation
import 'package:uuid/uuid.dart';

final uuid = Uuid();

await LinkRunner().trackEvent(
  eventName: 'purchase_initiated',
  eventData: { ... },
  eventId: uuid.v4(), // Generate unique ID for deduplication
);
sdk/ios.mdx (2)

420-420: Foundation import may be unnecessary.

The added import Foundation isn't strictly required for UUID generation in Swift since UUID is available without it in most Swift contexts (it's part of the Swift standard library overlay). However, it doesn't cause any harm.


264-286: Clear eventId documentation for iOS.

The trackEvent example and accompanying Note effectively communicate the optional eventId parameter's purpose for server-side deduplication. Consider showing Swift's native UUID generation:

💡 Optional: Show Swift UUID generation
try await LinkrunnerSDK.shared.trackEvent(
    eventName: "purchase_initiated",
    eventData: [...],
    eventId: UUID().uuidString // Generate unique ID for deduplication
)
sdk/react-native.mdx (1)

212-224: Good eventId documentation for React Native.

The trackEvent example clearly shows the optional third parameter for eventId with appropriate inline comments. The Note effectively explains the deduplication use case.

Consider showing UUID generation using a package like uuid:

💡 Optional: Show UUID generation
import { v4 as uuidv4 } from 'uuid';

await linkrunner.trackEvent(
    "purchase_initiated",
    { product_id: "12345", category: "electronics", amount: 99.99 },
    uuidv4() // Generate unique ID for deduplication
);

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Lite

📥 Commits

Reviewing files that changed from the base of the PR and between 4612cf9 and 8028848.

📒 Files selected for processing (6)
  • api-reference/event-capture.mdx
  • sdk/android.mdx
  • sdk/flutter.mdx
  • sdk/flutter/usage.mdx
  • sdk/ios.mdx
  • sdk/react-native.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • api-reference/event-capture.mdx
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2026-01-12T05:10:03.938Z
Learnt from: CR
Repo: linkrunner-labs/linkrunner-dashboard PR: 0
File: .cursor/rules/posthog-analytics.mdc:0-0
Timestamp: 2026-01-12T05:10:03.938Z
Learning: Applies to **/*.{ts,tsx} : Include relevant context properties in tracked events such as `campaign_id`, `campaign_name`, `item_name`, `action_type`, and other domain-specific identifiers

Applied to files:

  • sdk/react-native.mdx
📚 Learning: 2026-01-12T05:10:03.938Z
Learnt from: CR
Repo: linkrunner-labs/linkrunner-dashboard PR: 0
File: .cursor/rules/posthog-analytics.mdc:0-0
Timestamp: 2026-01-12T05:10:03.938Z
Learning: Applies to **/*.{ts,tsx} : Use the `useAnalytics` hook to track events via the `trackEvent` function instead of calling PostHog directly

Applied to files:

  • sdk/react-native.mdx
📚 Learning: 2026-01-12T05:10:03.938Z
Learnt from: CR
Repo: linkrunner-labs/linkrunner-dashboard PR: 0
File: .cursor/rules/posthog-analytics.mdc:0-0
Timestamp: 2026-01-12T05:10:03.938Z
Learning: All tracked events automatically include common properties: `project_id`, `project_name`, `user_id`, `user_email`, `username`, and `timestamp` through the centralized `useAnalytics` hook

Applied to files:

  • sdk/react-native.mdx
  • sdk/flutter.mdx
  • sdk/android.mdx
  • sdk/ios.mdx
📚 Learning: 2025-11-28T10:03:01.270Z
Learnt from: CR
Repo: linkrunner-labs/linkrunner-backend PR: 0
File: .cursor/rules/google-ads-api.mdc:0-0
Timestamp: 2025-11-28T10:03:01.270Z
Learning: Understand the structure of Google Ads API responses, including fields such as ad_event_id, campaign_id, campaign_name, campaign_type, external_customer_id, location, network_type, network_subtype, timestamp, video_id, ad_group_id, creative_id, keyword, match_type, placement, ad_type, interaction_type, conversion_metric, and ad_group_name

Applied to files:

  • sdk/flutter.mdx
  • sdk/android.mdx
  • sdk/ios.mdx
📚 Learning: 2025-11-28T10:03:01.270Z
Learnt from: CR
Repo: linkrunner-labs/linkrunner-backend PR: 0
File: .cursor/rules/google-ads-api.mdc:0-0
Timestamp: 2025-11-28T10:03:01.270Z
Learning: Google Ads API requests should include query parameters such as market_referrer_gclid, rdid, link_id, gbraid, dev_token, app_event_type, id_type, eea, ad_personalization, ad_user_data, lat, app_version, os_version, sdk_version, timestamp, and gclid_only_request

Applied to files:

  • sdk/flutter.mdx
🔇 Additional comments (6)
sdk/android.mdx (1)

372-373: Consistent eventId additions across examples.

The eventId parameter is consistently documented in the purchase event and complete example sections.

Also applies to: 614-615

sdk/flutter/usage.mdx (1)

389-403: Complete example includes eventId correctly.

The button click example in the complete section demonstrates the eventId usage appropriately.

sdk/ios.mdx (1)

301-302: Consistent eventId usage in purchase and complete examples.

The eventId parameter is properly documented in both the revenue tracking and complete example sections.

Also applies to: 468-469

sdk/flutter.mdx (2)

340-361: Well-documented eventId parameter for Flutter.

The documentation clearly explains the optional eventId parameter and its deduplication purpose. The Note block provides useful guidance about coordinating with the Event Capture API.


367-384: Consistent eventId examples in purchase and complete sections.

The eventId parameter is properly documented across all relevant examples.

Also applies to: 746-749

sdk/react-native.mdx (1)

231-241: Consistent eventId in revenue tracking example.

The purchase event example properly demonstrates the eventId parameter usage.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

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