From d276622a5289d2573724b36fa840c8e9ecbaa06b Mon Sep 17 00:00:00 2001 From: chetan Date: Fri, 7 Nov 2025 19:22:48 +0530 Subject: [PATCH 1/5] fix added event_id --- api-reference/event-capture.mdx | 18 +++++++++++++++--- sdk/android/usage.mdx | 18 +++++++++++++++--- sdk/flutter/usage.mdx | 22 +++++++++++++++++++++- sdk/ios/usage.mdx | 18 +++++++++++++++--- sdk/react-native/usage.mdx | 25 +++++++++++++++++++------ 5 files changed, 85 insertions(+), 16 deletions(-) diff --git a/api-reference/event-capture.mdx b/api-reference/event-capture.mdx index 5377a0e..69faacc 100644 --- a/api-reference/event-capture.mdx +++ b/api-reference/event-capture.mdx @@ -40,7 +40,8 @@ POST: /capture-event "currency": "USD", "is_featured": true }, - "user_id": "user_12345" + "user_id": "user_12345", + "event_id": "550e8400-e29b-41d4-a716-446655440000" } ``` @@ -49,6 +50,7 @@ POST: /capture-event | event_name | string | **Required**. Name of the event to track | | event_data | object | **Optional**. Additional data associated with the event | | user_id | string | **Required**. User identifier to associate with the event | +| event_id | string | **Optional**. Unique event identifier (String). Recommended to use UUID format for uniqueness | ### Responses @@ -97,7 +99,8 @@ To enable revenue sharing with ad networks like Google Ads and Meta, include an "category": "electronics", "amount": 149.99 }, - "user_id": "user_12345" + "user_id": "user_12345", + "event_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8" } ``` @@ -106,6 +109,10 @@ To enable revenue sharing with ad networks like Google Ads and Meta, include an string. + + The `event_id` parameter should be a unique String identifier for each event. It's recommended to use a UUID (Universally Unique Identifier) format to ensure uniqueness. This helps track and deduplicate events on the server side. + + ## Best Practices 1. **Consistent naming**: Use consistent naming conventions for your events (snake_case is recommended) @@ -118,7 +125,10 @@ To enable revenue sharing with ad networks like Google Ads and Meta, include an ### Tracking a Purchase Event ```javascript -// Using fetch API +// Using fetch API with crypto.randomUUID() (available in Node.js 14.17.0+ and modern browsers) +// For older environments, use a UUID library like 'uuid' +import { v4 as uuidv4 } from 'uuid'; // npm install uuid + fetch("https://api.linkrunner.io/api/v1/capture-event", { method: "POST", headers: { @@ -135,6 +145,8 @@ fetch("https://api.linkrunner.io/api/v1/capture-event", { payment_method: "credit_card", }, user_id: "user_12345", + event_id: uuidv4(), // Recommended: Use UUID for uniqueness + // Alternative: event_id: crypto.randomUUID() // Available in Node.js 14.17.0+ and modern browsers }), }) .then((response) => response.json()) diff --git a/sdk/android/usage.mdx b/sdk/android/usage.mdx index 12d04c0..2ea32f7 100644 --- a/sdk/android/usage.mdx +++ b/sdk/android/usage.mdx @@ -197,6 +197,8 @@ private fun setIntegrationData() { Track custom events in your app: ```kotlin +import java.util.UUID + private fun trackEvent() { CoroutineScope(Dispatchers.IO).launch { try { @@ -206,7 +208,8 @@ private fun trackEvent() { "product_id" to "12345", "category" to "electronics", "amount" to 99.99 // Include amount as a number for revenue sharing with ad networks like Google and Meta - ) + ), + eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ) result.onSuccess { @@ -221,11 +224,17 @@ private fun trackEvent() { } ``` + + The `eventId` parameter should be a unique String identifier for each event. It's recommended to use `UUID.randomUUID().toString()` to generate a unique identifier. This helps track and deduplicate events on the server side. + + ### Revenue Sharing with Ad Networks To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```kotlin +import java.util.UUID + private fun trackPurchaseEvent() { CoroutineScope(Dispatchers.IO).launch { try { @@ -235,7 +244,8 @@ private fun trackPurchaseEvent() { "product_id" to "12345", "category" to "electronics", "amount" to 149.99 // Revenue amount as a number - ) + ), + eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ) result.onSuccess { @@ -381,6 +391,7 @@ import io.linkrunner.sdk.models.request.UserDataRequest import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch +import java.util.UUID class MyApplication : Application() { override fun onCreate() { @@ -448,7 +459,8 @@ class MainActivity : AppCompatActivity() { try { LinkRunner.getInstance().trackEvent( eventName = "button_clicked", - eventData = mapOf("screen" to "main") + eventData = mapOf("screen" to "main"), + eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ) } catch (e: Exception) { println("Error tracking event: ${e.message}") diff --git a/sdk/flutter/usage.mdx b/sdk/flutter/usage.mdx index d913bac..3e96c0e 100644 --- a/sdk/flutter/usage.mdx +++ b/sdk/flutter/usage.mdx @@ -160,6 +160,10 @@ This method allows you to connect user identities across different analytics and Track custom events in your app: ```dart +import 'package:uuid/uuid.dart'; + +final _uuid = Uuid(); + Future trackEvent() async { try { await LinkRunner().trackEvent( @@ -169,6 +173,7 @@ Future trackEvent() async { 'category': 'electronics', 'amount': 99.99, // Include amount as a number for revenue sharing with ad networks like Google and Meta }, + eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ); print('Event tracked successfully'); } catch (e) { @@ -177,11 +182,19 @@ Future trackEvent() async { } ``` + + The `eventId` parameter should be a unique String identifier for each event. It's recommended to use the `uuid` package to generate a unique identifier. This helps track and deduplicate events on the server side. + + ### Revenue Sharing with Ad Networks To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```dart +import 'package:uuid/uuid.dart'; + +final _uuid = Uuid(); + Future trackPurchaseEvent() async { try { await LinkRunner().trackEvent( @@ -191,6 +204,7 @@ Future trackPurchaseEvent() async { 'category': 'electronics', 'amount': 149.99, // Revenue amount as a number }, + eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ); print('Purchase event with revenue tracked successfully'); } catch (e) { @@ -327,6 +341,9 @@ You can find your project token [here](https://www.linkrunner.io/dashboard?s=mem ```dart import 'package:flutter/material.dart'; import 'package:linkrunner/linkrunner.dart'; +import 'package:uuid/uuid.dart'; + +final _uuid = Uuid(); final linkrunner = LinkRunner(); @@ -381,7 +398,10 @@ class _HomeScreenState extends State { SizedBox(height: 20), ElevatedButton( onPressed: () async { - await LinkRunner().trackEvent(eventName: 'button_clicked'); + await LinkRunner().trackEvent( + eventName: 'button_clicked', + eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + ); }, child: Text('Track Custom Event'), ), diff --git a/sdk/ios/usage.mdx b/sdk/ios/usage.mdx index a973b58..bd1ec1d 100644 --- a/sdk/ios/usage.mdx +++ b/sdk/ios/usage.mdx @@ -187,6 +187,8 @@ func setAdditionalData() async { Track custom events in your app: ```swift +import Foundation + func trackEvent() async { do { try await LinkrunnerSDK.shared.trackEvent( @@ -195,7 +197,8 @@ func trackEvent() async { "product_id": "12345", "category": "electronics", "amount": 99.99 // Include amount as a number for revenue sharing with ad networks like Google and Meta - ] + ], + eventId: UUID().uuidString // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ) print("Event tracked successfully") } catch { @@ -204,11 +207,17 @@ func trackEvent() async { } ``` + + The `eventId` parameter should be a unique String identifier for each event. It's recommended to use `UUID().uuidString` to generate a unique identifier. This helps track and deduplicate events on the server side. + + ### Revenue Sharing with Ad Networks To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```swift +import Foundation + func trackPurchaseEvent() async { do { try await LinkrunnerSDK.shared.trackEvent( @@ -217,7 +226,8 @@ func trackPurchaseEvent() async { "product_id": "12345", "category": "electronics", "amount": 149.99 // Revenue amount as a number - ] + ], + eventId: UUID().uuidString // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ) print("Purchase event with revenue tracked successfully") } catch { @@ -335,6 +345,7 @@ You can find your project token [here](https://www.linkrunner.io/dashboard?s=mem ```swift import SwiftUI import Linkrunner +import Foundation @main struct MyApp: App { @@ -382,7 +393,8 @@ struct ContentView: View { do { try await LinkrunnerSDK.shared.trackEvent( eventName: "button_clicked", - eventData: ["screen": "home"] + eventData: ["screen": "home"], + eventId: UUID().uuidString // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ) print("Event tracked successfully") } catch { diff --git a/sdk/react-native/usage.mdx b/sdk/react-native/usage.mdx index 3c3dea8..c29bd1c 100644 --- a/sdk/react-native/usage.mdx +++ b/sdk/react-native/usage.mdx @@ -161,25 +161,38 @@ This method allows you to connect user identities across different analytics and Track custom events in your app: ```javascript +import { v4 as uuidv4 } from 'uuid'; // or use crypto.randomUUID() if available + const trackEvent = async () => { await linkrunner.trackEvent( "purchase_initiated", // Event name - { product_id: "12345", category: "electronics", amount: 99.99 } // Optional: Event data, include amount as a number for revenue sharing with ad networks like Google and Meta + { product_id: "12345", category: "electronics", amount: 99.99 }, // Optional: Event data, include amount as a number for revenue sharing with ad networks like Google and Meta + uuidv4() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ); }; ``` + + The `eventId` parameter should be a unique String identifier for each event. It's recommended to use a UUID library (like `uuid`) or `crypto.randomUUID()` to generate a unique identifier. This helps track and deduplicate events on the server side. + + ### Revenue Sharing with Ad Networks To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```javascript +import { v4 as uuidv4 } from 'uuid'; // or use crypto.randomUUID() if available + const trackPurchaseEvent = async () => { - await linkrunner.trackEvent("purchase_completed", { - product_id: "12345", - category: "electronics", - amount: 149.99, // Revenue amount as a number - }); + await linkrunner.trackEvent( + "purchase_completed", + { + product_id: "12345", + category: "electronics", + amount: 149.99, // Revenue amount as a number + }, + uuidv4() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + ); }; ``` From c670b343d7f9c0a3a080cbcff9f07de20741759d Mon Sep 17 00:00:00 2001 From: chetan Date: Wed, 14 Jan 2026 12:48:56 +0530 Subject: [PATCH 2/5] added docs events --- dashboard-links-audit.json | 127 +++++++++++++++++++++++++++++++++++++ sdk/android/usage.mdx | 2 +- 2 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 dashboard-links-audit.json diff --git a/dashboard-links-audit.json b/dashboard-links-audit.json new file mode 100644 index 0000000..1a42b19 --- /dev/null +++ b/dashboard-links-audit.json @@ -0,0 +1,127 @@ +[ + { + "url": "https://dashboard.linkrunner.io/settings?s=data-apis", + "purpose": "Access Data APIs settings to obtain server key for authentication", + "context": "Used for API authentication setup in Data APIs and Campaign APIs documentation", + "files": [ + "api-reference/data-apis.mdx", + "api-reference/campaign-apis.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?p_id=4&s=data-apis", + "purpose": "Generate server code and access server key for revenue tracking and event capture APIs", + "context": "Used for server-side API authentication setup", + "files": [ + "api-reference/revenue-tracking.mdx", + "api-reference/event-capture.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?sort_by=activity-1&s=meta-integration&meta_tab=meta-ad-account", + "purpose": "Connect and configure Meta advertising account with Linkrunner for web-to-app campaigns", + "context": "Meta Web to App integration setup", + "files": [ + "ad-networks/meta-web-to-app.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/dashboard?m=create-campaign", + "purpose": "Create new campaigns with deferred deep linking configuration", + "context": "Campaign creation for deferred deep linking setup", + "files": [ + "features/deferred-deep-linking.mdx", + "testing/integration-testing.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?sort_by=activity-1&s=store-verification", + "purpose": "Configure domain verification for App Links (Android) and Universal Links (iOS)", + "context": "Upload iOS and Android JSON verification objects for deep linking", + "files": [ + "features/deep-linking-verification.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/dashboard?s=members&m=documentation", + "purpose": "Find project token for SDK initialization", + "context": "SDK setup and initialization - used across all SDK documentation", + "files": [ + "sdk/react-native.mdx", + "sdk/android.mdx", + "sdk/flutter.mdx", + "sdk/ios.mdx", + "quickstart.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?s=sdk-signing", + "purpose": "Find project token, secret key, and key ID for enhanced SDK security signing", + "context": "SDK signing parameters for secure authentication", + "files": [ + "sdk/react-native.mdx", + "sdk/android.mdx", + "sdk/flutter.mdx", + "sdk/ios.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?s=domains", + "purpose": "Add and configure subdomain for referral code tracking and domain verification", + "context": "Domain setup for deep linking and referral tracking", + "files": [ + "features/referral-codes.mdx", + "testing/integration-testing.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?s=google-ads-integration§ion=skadnetwork&p_id=27&google_ads=skan_integration", + "purpose": "Complete Google Ads SKAdNetwork integration checklist", + "context": "Configure SKAdNetwork for Google Ads campaigns on iOS", + "files": [ + "features/skadnetwork-integration.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?s=meta-integration§ion=skadnetwork&p_id=27&google_ads=skan_integration&meta_tab=skan_integration", + "purpose": "Complete Meta (Facebook) SKAdNetwork integration checklist", + "context": "Configure SKAdNetwork for Meta ad campaigns on iOS", + "files": [ + "features/skadnetwork-integration.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io", + "purpose": "Access main dashboard homepage", + "context": "General dashboard access for campaign creation and management", + "files": [ + "ad-networks/tiktok.mdx", + "ad-networks/meta-ads.mdx", + "docs.json" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?s=meta-integration", + "purpose": "Configure Meta app integration with App ID and Referrer Decryption Key", + "context": "Setup Meta Ads integration for attribution tracking and event mapping", + "files": [ + "ad-networks/meta-ads.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/settings?s=store-listings", + "purpose": "Create and manage custom store listings for targeted app marketing", + "context": "Configure custom Play Store and App Store listings for campaigns", + "files": [ + "features/custom-store-listing.mdx" + ] + }, + { + "url": "https://dashboard.linkrunner.io/dashboard?m=documentation", + "purpose": "Find project token for SDK initialization (alternate URL path)", + "context": "Alternative path to access project token for Flutter SDK", + "files": [ + "sdk/flutter.mdx" + ] + } +] diff --git a/sdk/android/usage.mdx b/sdk/android/usage.mdx index 2ea32f7..822828e 100644 --- a/sdk/android/usage.mdx +++ b/sdk/android/usage.mdx @@ -460,7 +460,7 @@ class MainActivity : AppCompatActivity() { LinkRunner.getInstance().trackEvent( eventName = "button_clicked", eventData = mapOf("screen" to "main"), - eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness. ) } catch (e: Exception) { println("Error tracking event: ${e.message}") From de634c8c1f7307aec1cc6550c2232afb927ae04d Mon Sep 17 00:00:00 2001 From: chetan Date: Wed, 14 Jan 2026 12:50:13 +0530 Subject: [PATCH 3/5] delete json file --- dashboard-links-audit.json | 127 ------------------------------------- 1 file changed, 127 deletions(-) delete mode 100644 dashboard-links-audit.json diff --git a/dashboard-links-audit.json b/dashboard-links-audit.json deleted file mode 100644 index 1a42b19..0000000 --- a/dashboard-links-audit.json +++ /dev/null @@ -1,127 +0,0 @@ -[ - { - "url": "https://dashboard.linkrunner.io/settings?s=data-apis", - "purpose": "Access Data APIs settings to obtain server key for authentication", - "context": "Used for API authentication setup in Data APIs and Campaign APIs documentation", - "files": [ - "api-reference/data-apis.mdx", - "api-reference/campaign-apis.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?p_id=4&s=data-apis", - "purpose": "Generate server code and access server key for revenue tracking and event capture APIs", - "context": "Used for server-side API authentication setup", - "files": [ - "api-reference/revenue-tracking.mdx", - "api-reference/event-capture.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?sort_by=activity-1&s=meta-integration&meta_tab=meta-ad-account", - "purpose": "Connect and configure Meta advertising account with Linkrunner for web-to-app campaigns", - "context": "Meta Web to App integration setup", - "files": [ - "ad-networks/meta-web-to-app.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/dashboard?m=create-campaign", - "purpose": "Create new campaigns with deferred deep linking configuration", - "context": "Campaign creation for deferred deep linking setup", - "files": [ - "features/deferred-deep-linking.mdx", - "testing/integration-testing.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?sort_by=activity-1&s=store-verification", - "purpose": "Configure domain verification for App Links (Android) and Universal Links (iOS)", - "context": "Upload iOS and Android JSON verification objects for deep linking", - "files": [ - "features/deep-linking-verification.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/dashboard?s=members&m=documentation", - "purpose": "Find project token for SDK initialization", - "context": "SDK setup and initialization - used across all SDK documentation", - "files": [ - "sdk/react-native.mdx", - "sdk/android.mdx", - "sdk/flutter.mdx", - "sdk/ios.mdx", - "quickstart.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?s=sdk-signing", - "purpose": "Find project token, secret key, and key ID for enhanced SDK security signing", - "context": "SDK signing parameters for secure authentication", - "files": [ - "sdk/react-native.mdx", - "sdk/android.mdx", - "sdk/flutter.mdx", - "sdk/ios.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?s=domains", - "purpose": "Add and configure subdomain for referral code tracking and domain verification", - "context": "Domain setup for deep linking and referral tracking", - "files": [ - "features/referral-codes.mdx", - "testing/integration-testing.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?s=google-ads-integration§ion=skadnetwork&p_id=27&google_ads=skan_integration", - "purpose": "Complete Google Ads SKAdNetwork integration checklist", - "context": "Configure SKAdNetwork for Google Ads campaigns on iOS", - "files": [ - "features/skadnetwork-integration.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?s=meta-integration§ion=skadnetwork&p_id=27&google_ads=skan_integration&meta_tab=skan_integration", - "purpose": "Complete Meta (Facebook) SKAdNetwork integration checklist", - "context": "Configure SKAdNetwork for Meta ad campaigns on iOS", - "files": [ - "features/skadnetwork-integration.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io", - "purpose": "Access main dashboard homepage", - "context": "General dashboard access for campaign creation and management", - "files": [ - "ad-networks/tiktok.mdx", - "ad-networks/meta-ads.mdx", - "docs.json" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?s=meta-integration", - "purpose": "Configure Meta app integration with App ID and Referrer Decryption Key", - "context": "Setup Meta Ads integration for attribution tracking and event mapping", - "files": [ - "ad-networks/meta-ads.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/settings?s=store-listings", - "purpose": "Create and manage custom store listings for targeted app marketing", - "context": "Configure custom Play Store and App Store listings for campaigns", - "files": [ - "features/custom-store-listing.mdx" - ] - }, - { - "url": "https://dashboard.linkrunner.io/dashboard?m=documentation", - "purpose": "Find project token for SDK initialization (alternate URL path)", - "context": "Alternative path to access project token for Flutter SDK", - "files": [ - "sdk/flutter.mdx" - ] - } -] From 4612cf917d4a622132d5a810560a2943e1635d81 Mon Sep 17 00:00:00 2001 From: chetan Date: Wed, 14 Jan 2026 13:02:48 +0530 Subject: [PATCH 4/5] added uuid in the flutter code --- sdk/flutter.mdx | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sdk/flutter.mdx b/sdk/flutter.mdx index 76cb767..ad0f6f2 100644 --- a/sdk/flutter.mdx +++ b/sdk/flutter.mdx @@ -337,7 +337,19 @@ This method allows you to connect user identities across different analytics and Track custom events in your app: + + To use UUID generation, first add the `uuid` package to your `pubspec.yaml`: + + ```bash + flutter pub add uuid + ``` + + ```dart +import 'package:uuid/uuid.dart'; + +final _uuid = Uuid(); + Future trackEvent() async { try { await LinkRunner().trackEvent( @@ -347,6 +359,7 @@ Future trackEvent() async { 'category': 'electronics', 'amount': 99.99, // Include amount as a number for revenue sharing with ad networks like Google and Meta }, + eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ); print('Event tracked successfully'); } catch (e) { @@ -355,11 +368,19 @@ Future trackEvent() async { } ``` + + The `eventId` parameter should be a unique String identifier for each event. It's recommended to use the `uuid` package to generate a unique identifier. This helps track and deduplicate events on the server side. + + ### Revenue Sharing with Ad Networks To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```dart +import 'package:uuid/uuid.dart'; + +final _uuid = Uuid(); + Future trackPurchaseEvent() async { try { await LinkRunner().trackEvent( @@ -369,6 +390,7 @@ Future trackPurchaseEvent() async { 'category': 'electronics', 'amount': 149.99, // Revenue amount as a number }, + eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness ); print('Purchase event with revenue tracked successfully'); } catch (e) { @@ -683,7 +705,9 @@ You can find your project token [here](https://dashboard.linkrunner.io/dashboard ```dart import 'package:flutter/material.dart'; import 'package:linkrunner/linkrunner.dart'; +import 'package:uuid/uuid.dart'; +final _uuid = Uuid(); final linkrunner = LinkRunner(); void main() { @@ -737,7 +761,10 @@ class _HomeScreenState extends State { SizedBox(height: 20), ElevatedButton( onPressed: () async { - await LinkRunner().trackEvent(eventName: 'button_clicked'); + await LinkRunner().trackEvent( + eventName: 'button_clicked', + eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + ); }, child: Text('Track Custom Event'), ), From 80288484f02ab0a5dc652fb4f4133151f9095422 Mon Sep 17 00:00:00 2001 From: chetan Date: Wed, 14 Jan 2026 14:48:40 +0530 Subject: [PATCH 5/5] updated docs, removed uuid and added redirection from sdks to event capture --- api-reference/event-capture.mdx | 13 ++++--------- sdk/android.mdx | 13 ++++--------- sdk/flutter.mdx | 26 ++++---------------------- sdk/flutter/usage.mdx | 18 ++++-------------- sdk/ios.mdx | 12 ++++-------- sdk/react-native.mdx | 10 +++------- 6 files changed, 23 insertions(+), 69 deletions(-) diff --git a/api-reference/event-capture.mdx b/api-reference/event-capture.mdx index 0aef398..863c541 100644 --- a/api-reference/event-capture.mdx +++ b/api-reference/event-capture.mdx @@ -50,7 +50,7 @@ POST: /capture-event | event_name | string | **Required**. Name of the event to track | | event_data | object | **Optional**. Additional data associated with the event | | user_id | string | **Required**. User identifier to associate with the event | -| event_id | string | **Optional**. Unique event identifier (String). Recommended to use UUID format for uniqueness | +| event_id | string | **Optional**. Unique event identifier (String) for deduplication. If you're tracking the same event from both your app (SDK) and backend (API), make sure to send the same `event_id` from both sources | ### Responses @@ -100,7 +100,7 @@ To enable revenue sharing with ad networks like Google Ads and Meta, include an "amount": 149.99 }, "user_id": "user_12345", - "event_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8" + "event_id": "550e8400-e29b-41d4-a716-446655440000" } ``` @@ -110,7 +110,7 @@ To enable revenue sharing with ad networks like Google Ads and Meta, include an - The `event_id` parameter should be a unique String identifier for each event. It's recommended to use a UUID (Universally Unique Identifier) format to ensure uniqueness. This helps track and deduplicate events on the server side. + The `event_id` parameter is optional and should be a unique String identifier for each event. It's used for deduplication on the server side. If you're tracking the same event from both your app (SDK) and backend (API), make sure to send the same `event_id` from both sources to prevent duplicate event tracking. ## Best Practices @@ -125,10 +125,6 @@ To enable revenue sharing with ad networks like Google Ads and Meta, include an ### Tracking a Purchase Event ```javascript -// Using fetch API with crypto.randomUUID() (available in Node.js 14.17.0+ and modern browsers) -// For older environments, use a UUID library like 'uuid' -import { v4 as uuidv4 } from 'uuid'; // npm install uuid - fetch("https://api.linkrunner.io/api/v1/capture-event", { method: "POST", headers: { @@ -145,8 +141,7 @@ fetch("https://api.linkrunner.io/api/v1/capture-event", { payment_method: "credit_card", }, user_id: "user_12345", - event_id: uuidv4(), // Recommended: Use UUID for uniqueness - // Alternative: event_id: crypto.randomUUID() // Available in Node.js 14.17.0+ and modern browsers + event_id: "550e8400-e29b-41d4-a716-446655440000", // Optional: Unique event identifier for deduplication. Use the same event_id if tracking from both SDK and API }), }) .then((response) => response.json()) diff --git a/sdk/android.mdx b/sdk/android.mdx index dba645b..a63950e 100644 --- a/sdk/android.mdx +++ b/sdk/android.mdx @@ -326,8 +326,6 @@ private fun setIntegrationData() { Track custom events in your app: ```kotlin -import java.util.UUID - private fun trackEvent() { CoroutineScope(Dispatchers.IO).launch { try { @@ -338,7 +336,7 @@ private fun trackEvent() { "category" to "electronics", "amount" to 99.99 // Include amount as a number for revenue sharing with ad networks like Google and Meta ), - eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId = "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication ) result.onSuccess { @@ -354,7 +352,7 @@ private fun trackEvent() { ``` - The `eventId` parameter should be a unique String identifier for each event. It's recommended to use `UUID.randomUUID().toString()` to generate a unique identifier. This helps track and deduplicate events on the server side. + The `eventId` parameter is optional and should be a unique String identifier for each event. It's used for deduplication on the server side. If you're tracking the same event from both your app and backend, make sure to send the same `eventId` from the [Event Capture API](/api-reference/event-capture) as well. ### Revenue Sharing with Ad Networks @@ -362,8 +360,6 @@ private fun trackEvent() { To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```kotlin -import java.util.UUID - private fun trackPurchaseEvent() { CoroutineScope(Dispatchers.IO).launch { try { @@ -374,7 +370,7 @@ private fun trackPurchaseEvent() { "category" to "electronics", "amount" to 149.99 // Revenue amount as a number ), - eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId = "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication ) result.onSuccess { @@ -548,7 +544,6 @@ import io.linkrunner.sdk.models.request.UserDataRequest import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import java.util.UUID class MyApplication : Application() { override fun onCreate() { @@ -617,7 +612,7 @@ class MainActivity : AppCompatActivity() { LinkRunner.getInstance().trackEvent( eventName = "button_clicked", eventData = mapOf("screen" to "main"), - eventId = UUID.randomUUID().toString() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness. + eventId = "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication ) } catch (e: Exception) { println("Error tracking event: ${e.message}") diff --git a/sdk/flutter.mdx b/sdk/flutter.mdx index ad0f6f2..972d09b 100644 --- a/sdk/flutter.mdx +++ b/sdk/flutter.mdx @@ -337,19 +337,7 @@ This method allows you to connect user identities across different analytics and Track custom events in your app: - - To use UUID generation, first add the `uuid` package to your `pubspec.yaml`: - - ```bash - flutter pub add uuid - ``` - - ```dart -import 'package:uuid/uuid.dart'; - -final _uuid = Uuid(); - Future trackEvent() async { try { await LinkRunner().trackEvent( @@ -359,7 +347,7 @@ Future trackEvent() async { 'category': 'electronics', 'amount': 99.99, // Include amount as a number for revenue sharing with ad networks like Google and Meta }, - eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: '550e8400-e29b-41d4-a716-446655440000', // Optional: Unique event identifier (String) for deduplication ); print('Event tracked successfully'); } catch (e) { @@ -369,7 +357,7 @@ Future trackEvent() async { ``` - The `eventId` parameter should be a unique String identifier for each event. It's recommended to use the `uuid` package to generate a unique identifier. This helps track and deduplicate events on the server side. + The `eventId` parameter is optional and should be a unique String identifier for each event. It's used for deduplication on the server side. If you're tracking the same event from both your app and backend, make sure to send the same `eventId` from the [Event Capture API](/api-reference/event-capture) as well. ### Revenue Sharing with Ad Networks @@ -377,10 +365,6 @@ Future trackEvent() async { To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```dart -import 'package:uuid/uuid.dart'; - -final _uuid = Uuid(); - Future trackPurchaseEvent() async { try { await LinkRunner().trackEvent( @@ -390,7 +374,7 @@ Future trackPurchaseEvent() async { 'category': 'electronics', 'amount': 149.99, // Revenue amount as a number }, - eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: '550e8400-e29b-41d4-a716-446655440000', // Optional: Unique event identifier (String) for deduplication ); print('Purchase event with revenue tracked successfully'); } catch (e) { @@ -705,9 +689,7 @@ You can find your project token [here](https://dashboard.linkrunner.io/dashboard ```dart import 'package:flutter/material.dart'; import 'package:linkrunner/linkrunner.dart'; -import 'package:uuid/uuid.dart'; -final _uuid = Uuid(); final linkrunner = LinkRunner(); void main() { @@ -763,7 +745,7 @@ class _HomeScreenState extends State { onPressed: () async { await LinkRunner().trackEvent( eventName: 'button_clicked', - eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: '550e8400-e29b-41d4-a716-446655440000', // Optional: Unique event identifier (String) for deduplication ); }, child: Text('Track Custom Event'), diff --git a/sdk/flutter/usage.mdx b/sdk/flutter/usage.mdx index 3e96c0e..5f0928b 100644 --- a/sdk/flutter/usage.mdx +++ b/sdk/flutter/usage.mdx @@ -160,10 +160,6 @@ This method allows you to connect user identities across different analytics and Track custom events in your app: ```dart -import 'package:uuid/uuid.dart'; - -final _uuid = Uuid(); - Future trackEvent() async { try { await LinkRunner().trackEvent( @@ -173,7 +169,7 @@ Future trackEvent() async { 'category': 'electronics', 'amount': 99.99, // Include amount as a number for revenue sharing with ad networks like Google and Meta }, - eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: '550e8400-e29b-41d4-a716-446655440000', // Optional: Unique event identifier (String) for deduplication ); print('Event tracked successfully'); } catch (e) { @@ -183,7 +179,7 @@ Future trackEvent() async { ``` - The `eventId` parameter should be a unique String identifier for each event. It's recommended to use the `uuid` package to generate a unique identifier. This helps track and deduplicate events on the server side. + The `eventId` parameter is optional and should be a unique String identifier for each event. It's used for deduplication on the server side. If you're tracking the same event from both your app and backend, make sure to send the same `eventId` from the [Event Capture API](/api-reference/event-capture) as well. ### Revenue Sharing with Ad Networks @@ -191,10 +187,6 @@ Future trackEvent() async { To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```dart -import 'package:uuid/uuid.dart'; - -final _uuid = Uuid(); - Future trackPurchaseEvent() async { try { await LinkRunner().trackEvent( @@ -204,7 +196,7 @@ Future trackPurchaseEvent() async { 'category': 'electronics', 'amount': 149.99, // Revenue amount as a number }, - eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: '550e8400-e29b-41d4-a716-446655440000', // Optional: Unique event identifier (String) for deduplication ); print('Purchase event with revenue tracked successfully'); } catch (e) { @@ -341,9 +333,7 @@ You can find your project token [here](https://www.linkrunner.io/dashboard?s=mem ```dart import 'package:flutter/material.dart'; import 'package:linkrunner/linkrunner.dart'; -import 'package:uuid/uuid.dart'; -final _uuid = Uuid(); final linkrunner = LinkRunner(); @@ -400,7 +390,7 @@ class _HomeScreenState extends State { onPressed: () async { await LinkRunner().trackEvent( eventName: 'button_clicked', - eventId: _uuid.v4(), // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: '550e8400-e29b-41d4-a716-446655440000', // Optional: Unique event identifier (String) for deduplication ); }, child: Text('Track Custom Event'), diff --git a/sdk/ios.mdx b/sdk/ios.mdx index 4015679..3d88ab1 100644 --- a/sdk/ios.mdx +++ b/sdk/ios.mdx @@ -263,8 +263,6 @@ func setAdditionalData() async { Track custom events in your app: ```swift -import Foundation - func trackEvent() async { do { try await LinkrunnerSDK.shared.trackEvent( @@ -274,7 +272,7 @@ func trackEvent() async { "category": "electronics", "amount": 99.99 // Include amount as a number for revenue sharing with ad networks like Google and Meta ], - eventId: UUID().uuidString // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication ) print("Event tracked successfully") } catch { @@ -284,7 +282,7 @@ func trackEvent() async { ``` - The `eventId` parameter should be a unique String identifier for each event. It's recommended to use `UUID().uuidString` to generate a unique identifier. This helps track and deduplicate events on the server side. + The `eventId` parameter is optional and should be a unique String identifier for each event. It's used for deduplication on the server side. If you're tracking the same event from both your app and backend, make sure to send the same `eventId` from the [Event Capture API](/api-reference/event-capture) as well. ### Revenue Sharing with Ad Networks @@ -292,8 +290,6 @@ func trackEvent() async { To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```swift -import Foundation - func trackPurchaseEvent() async { do { try await LinkrunnerSDK.shared.trackEvent( @@ -303,7 +299,7 @@ func trackPurchaseEvent() async { "category": "electronics", "amount": 149.99 // Revenue amount as a number ], - eventId: UUID().uuidString // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication ) print("Purchase event with revenue tracked successfully") } catch { @@ -470,7 +466,7 @@ struct ContentView: View { try await LinkrunnerSDK.shared.trackEvent( eventName: "button_clicked", eventData: ["screen": "home"], - eventId: UUID().uuidString // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + eventId: "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication ) print("Event tracked successfully") } catch { diff --git a/sdk/react-native.mdx b/sdk/react-native.mdx index f64fe89..e2e8ff4 100644 --- a/sdk/react-native.mdx +++ b/sdk/react-native.mdx @@ -210,19 +210,17 @@ This method allows you to connect user identities across different analytics and Track custom events in your app: ```javascript -import { v4 as uuidv4 } from 'uuid'; // or use crypto.randomUUID() if available - const trackEvent = async () => { await linkrunner.trackEvent( "purchase_initiated", // Event name { product_id: "12345", category: "electronics", amount: 99.99 }, // Optional: Event data, include amount as a number for revenue sharing with ad networks like Google and Meta - uuidv4() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication ); }; ``` - The `eventId` parameter should be a unique String identifier for each event. It's recommended to use a UUID library (like `uuid`) or `crypto.randomUUID()` to generate a unique identifier. This helps track and deduplicate events on the server side. + The `eventId` parameter is optional and should be a unique String identifier for each event. It's used for deduplication on the server side. If you're tracking the same event from both your app and backend, make sure to send the same `eventId` from the [Event Capture API](/api-reference/event-capture) as well. ### Revenue Sharing with Ad Networks @@ -230,8 +228,6 @@ const trackEvent = async () => { To enable revenue sharing with ad networks like Google Ads and Meta, include an `amount` parameter as a number in your custom event data. This allows the ad networks to optimize campaigns based on the revenue value of conversions: ```javascript -import { v4 as uuidv4 } from 'uuid'; // or use crypto.randomUUID() if available - const trackPurchaseEvent = async () => { await linkrunner.trackEvent( "purchase_completed", @@ -240,7 +236,7 @@ const trackPurchaseEvent = async () => { category: "electronics", amount: 149.99, // Revenue amount as a number }, - uuidv4() // Optional: Unique event identifier (String). Recommended to use UUID for uniqueness + "550e8400-e29b-41d4-a716-446655440000" // Optional: Unique event identifier (String) for deduplication ); }; ```