@datalyr/react-native 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +24 -141
  2. package/LICENSE +21 -0
  3. package/README.md +405 -217
  4. package/datalyr-react-native.podspec +31 -0
  5. package/ios/DatalyrNative.m +70 -0
  6. package/ios/DatalyrNative.swift +275 -0
  7. package/ios/DatalyrSKAdNetwork.m +26 -0
  8. package/lib/datalyr-sdk.d.ts +64 -3
  9. package/lib/datalyr-sdk.js +322 -3
  10. package/lib/index.d.ts +1 -0
  11. package/lib/index.js +4 -2
  12. package/lib/integrations/index.d.ts +6 -0
  13. package/lib/integrations/index.js +6 -0
  14. package/lib/integrations/meta-integration.d.ts +76 -0
  15. package/lib/integrations/meta-integration.js +218 -0
  16. package/lib/integrations/tiktok-integration.d.ts +82 -0
  17. package/lib/integrations/tiktok-integration.js +356 -0
  18. package/lib/native/DatalyrNativeBridge.d.ts +31 -0
  19. package/lib/native/DatalyrNativeBridge.js +168 -0
  20. package/lib/native/index.d.ts +5 -0
  21. package/lib/native/index.js +5 -0
  22. package/lib/types.d.ts +29 -0
  23. package/package.json +10 -5
  24. package/src/datalyr-sdk-expo.ts +957 -0
  25. package/src/datalyr-sdk.ts +419 -19
  26. package/src/expo.ts +38 -18
  27. package/src/index.ts +5 -2
  28. package/src/integrations/index.ts +7 -0
  29. package/src/integrations/meta-integration.ts +238 -0
  30. package/src/integrations/tiktok-integration.ts +360 -0
  31. package/src/native/DatalyrNativeBridge.ts +271 -0
  32. package/src/native/index.ts +11 -0
  33. package/src/types.ts +39 -0
  34. package/src/utils-expo.ts +25 -3
  35. package/src/utils-interface.ts +38 -0
  36. package/EXPO_INSTALL.md +0 -297
  37. package/INSTALL.md +0 -402
  38. package/examples/attribution-example.tsx +0 -377
  39. package/examples/auto-events-example.tsx +0 -403
  40. package/examples/example.tsx +0 -250
  41. package/examples/skadnetwork-example.tsx +0 -380
  42. package/examples/test-implementation.tsx +0 -163
package/CHANGELOG.md CHANGED
@@ -5,155 +5,38 @@ All notable changes to the Datalyr React Native SDK will be documented in this f
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.0.11] - 2025-06-23
8
+ ## [1.2.0] - 2025-01
9
9
 
10
- ### Fixed
11
- - **Race Condition Fix**: Resolved initialization race condition where install event was tracked before SDK was fully initialized
12
- - **Error Elimination**: Fixed "SDK not initialized. Call initialize() first" error during app install tracking
13
- - **Improved Reliability**: SDK now properly sets initialized state before tracking any events
14
-
15
- ## [1.0.10] - 2025-06-23
10
+ ### Added
11
+ - Bundled Meta (Facebook) SDK for iOS via native module
12
+ - Bundled TikTok Business SDK for iOS via native module
13
+ - Deferred deep link support for Meta attribution
14
+ - Advanced Matching support for Meta and TikTok
15
+ - Platform integration status methods
16
+ - `updateTrackingAuthorization()` for ATT handling
16
17
 
17
- ### Fixed
18
- - **Event Name Consistency**: Fixed screen view events to use `pageview` (singular) instead of `pageviews` (plural) to match web script
19
- - **Cross-Platform Alignment**: Both React Native SDK and web script now use identical event names
18
+ ### Changed
19
+ - Native SDKs are now bundled via CocoaPods (no additional npm packages required)
20
+ - E-commerce events auto-forward to Meta and TikTok when available
20
21
 
21
- ## [1.0.9] - 2025-06-23
22
+ ## [1.1.0] - 2025-01
22
23
 
23
24
  ### Fixed
24
- - **Authentication Issue Resolved**: Fixed "Invalid JWT" errors by identifying that Supabase Edge Function had JWT verification enabled
25
- - **Correct Endpoint**: Confirmed React Native SDK uses correct Cloudflare Worker endpoint (`https://datalyr-ingest.datalyr-ingest.workers.dev`)
26
- - **Architecture Alignment**: Both web script and React Native SDK now use the same authentication flow: SDK → Cloudflare Worker → Supabase Edge Function
27
-
28
- ### Technical Details
29
- - Root cause was Supabase Edge Function JWT setting, not SDK authentication logic
30
- - SDK correctly sends `Authorization: Bearer {apiKey}` header
31
- - Cloudflare Worker acts as transparent proxy to Supabase
32
- - Supabase Edge Function now uses custom API key validation instead of JWT verification
33
-
34
- ## [1.0.8] - 2025-06-23
35
-
36
- ### 🔧 ENDPOINT FIX - Resolves 401 Authentication Errors
37
-
38
- #### Changed
39
- - **Endpoint Update**: Changed default endpoint from `https://datalyr-ingest.datalyr-ingest.workers.dev` to `https://app.datalyr.com/api/ingest`
40
- - **Web Script Alignment**: SDK now uses the same endpoint as the web tracking script for consistency
41
-
42
- #### Fixed
43
- - **401 Unauthorized Errors**: Resolves authentication issues by using the correct production endpoint
44
- - **Infrastructure Alignment**: Mobile SDK now matches web infrastructure setup
45
-
46
- #### Technical Details
47
- - No breaking changes to the API
48
- - Existing API keys continue to work
49
- - Automatic retry logic remains unchanged
50
- - All other functionality preserved
51
-
52
- ---
53
-
54
- ## [1.0.7] - 2025-06-23
55
-
56
- ### 🔄 Changed
57
- - **BREAKING**: Changed automatic screen tracking event name from `screen_view` to `pageviews` for consistency with web analytics
58
- - Updated session tracking to report `pageviews` instead of `screen_views` in session end events
59
- - Updated session property names: `screen_views_in_session` → `pageviews_in_session`
60
-
61
- ### 🐛 Fixed
62
- - Fixed session end event payload structure
63
- - Improved session duration calculations
64
-
65
- ---
66
-
67
- ## [1.0.6] - 2025-06-23
68
-
69
- ### 🔑 CRITICAL FIX - API Authentication Added
25
+ - Race condition during initialization where install event was tracked before SDK was ready
26
+ - Screen view events now use `pageview` (singular) to match web script
27
+ - Authentication issues with Supabase Edge Function JWT verification
70
28
 
71
- **BREAKING CHANGE**: API key is now required for authentication.
29
+ ### Changed
30
+ - SDK now uses server-side API endpoint by default
31
+ - API key is now required for authentication
72
32
 
73
- #### Added
74
- - **API Key Authentication**: Added required `apiKey` field to `DatalyrConfig`
75
- - **HTTP Authorization**: SDK now sends `Authorization: Bearer {apiKey}` header
76
- - **401 Error Fix**: Resolves authentication errors with Datalyr API endpoints
33
+ ## [1.0.0] - 2024
77
34
 
78
- #### Changed
79
- - **DatalyrConfig Interface**: Added required `apiKey: string` field
80
- - **HttpClient**: Updated to include API key in request headers
81
- - **SDK Initialization**: Now validates both `workspaceId` and `apiKey`
82
-
83
- #### Migration Guide
84
- Update your SDK initialization to include the API key:
85
-
86
- ```typescript
87
- // OLD (v1.0.5 and earlier)
88
- await datalyr.initialize({
89
- workspaceId: 'your-workspace-id'
90
- });
91
-
92
- // NEW (v1.0.6+) - API key required
93
- await datalyr.initialize({
94
- workspaceId: 'your-workspace-id',
95
- apiKey: 'dk_your_api_key' // Get from Datalyr dashboard
96
- });
97
- ```
98
-
99
- **Where to find your API key:**
100
- - Check your web tracking script tag
101
- - Look for `data-api-key="dk_..."` attribute
102
- - Contact support if you need help locating it
103
-
104
- #### Technical Details
105
- - API keys follow format: `dk_` + random string
106
- - Keys are safe to include in client-side code (write-only permissions)
107
- - Similar to Google Analytics tracking IDs or Mixpanel project tokens
108
-
109
- ---
110
-
111
- ## [1.0.5] - 2025-01-23
112
-
113
- ### 🔄 Changed
114
- - **BREAKING**: Changed automatic screen tracking event name from `screen_view` to `pageviews` for consistency with web analytics
115
- - Updated session tracking to report `pageviews` instead of `screen_views` in session end events
116
- - Updated session property names: `screen_views_in_session` → `pageviews_in_session`
117
-
118
- ### 🐛 Fixed
119
- - Fixed SDK export pattern to use singleton instance instead of class constructor
120
- - Resolved white screen issues caused by incorrect import/export patterns
121
- - Fixed TypeScript compilation errors in example files
122
-
123
- ### 📚 Documentation
124
- - Updated all documentation to reflect `pageviews` instead of `screen_view`
125
- - Updated README.md, INSTALL.md, and EXPO_INSTALL.md
126
- - Updated SDK_COMPLETION_STATUS.md to show correct event names
127
- - Updated example files to use correct singleton import pattern
128
- - Updated example UI text to show "Pageview" instead of "Screen View"
129
-
130
- ### 🔧 Technical Details
131
- - Auto-events manager now tracks `pageviews` events for screen navigation
132
- - Main SDK `screen()` method now tracks `pageviews` events
133
- - Maintains backward compatibility for session tracking (still counts as `screenViews` internally)
134
- - Fixed import pattern: `import { datalyr } from '@datalyr/react-native-sdk'`
135
-
136
- ### 🎯 Impact
137
- - **Web Analytics Consistency**: Mobile screen tracking now uses the same event name (`pageviews`) as web page tracking
138
- - **Improved Developer Experience**: Fixed white screen issues and import errors
139
- - **Better Analytics**: Unified event naming makes cross-platform analytics easier
140
-
141
- ---
142
-
143
- ## [1.0.2] - Previous Release
144
-
145
- ### ✨ Features
35
+ ### Added
36
+ - Core event tracking with `track()`, `screen()`, `identify()`
146
37
  - Automatic event tracking (sessions, screen views, app lifecycle)
147
- - Mobile attribution tracking
38
+ - SKAdNetwork conversion value encoding with industry templates
39
+ - Mobile attribution tracking (UTM, click IDs)
40
+ - Event queue with offline support and batching
148
41
  - React Native and Expo support
149
42
  - TypeScript support
150
- - Automatic session management
151
- - App install detection
152
- - Performance tracking
153
-
154
- ### 🔧 Technical
155
- - Event queueing and batching
156
- - Offline support
157
- - Retry mechanisms
158
- - Debug logging
159
- - Storage persistence
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Datalyr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.