fleek-track-analytics 1.17.36 → 1.17.40

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 (41) hide show
  1. package/README.md +0 -69
  2. package/lib/node/analytics-tool/node-rudderstack.d.ts +10 -0
  3. package/lib/node/analytics-tool/node-rudderstack.js +76 -0
  4. package/lib/node/analytics-tool/node-rudderstack.js.map +1 -0
  5. package/lib/node/analytics-tool/rudderstack-default-config.js.map +1 -0
  6. package/lib/node/analytics-tool/rudderstack-event-routing.js +18 -0
  7. package/lib/node/analytics-tool/rudderstack-event-routing.js.map +1 -0
  8. package/lib/node/track-analytics/track-analytics-types.d.ts +1 -0
  9. package/lib/node/track-analytics/track-analytics.d.ts +2 -0
  10. package/lib/node/track-analytics/track-analytics.js +102 -11
  11. package/lib/node/track-analytics/track-analytics.js.map +1 -1
  12. package/lib/react-native/track-analytics/track-analytics.d.ts +0 -2
  13. package/lib/react-native/track-analytics/track-analytics.js +32 -152
  14. package/lib/react-native/track-analytics/track-analytics.js.map +1 -1
  15. package/lib/track-analytics-types.d.ts +0 -5
  16. package/lib/web/track-analytics/track-analytics.d.ts +0 -2
  17. package/lib/web/track-analytics/track-analytics.js +38 -139
  18. package/lib/web/track-analytics/track-analytics.js.map +1 -1
  19. package/package.json +3 -3
  20. package/EXPO_RN_TESTING_GUIDE.md +0 -283
  21. package/lib/react-native/analytics-tool/react-native-rudderstack.d.ts +0 -12
  22. package/lib/react-native/analytics-tool/react-native-rudderstack.js +0 -87
  23. package/lib/react-native/analytics-tool/react-native-rudderstack.js.map +0 -1
  24. package/lib/react-native/analytics-tool/rudderstack-default-config.js +0 -8
  25. package/lib/react-native/analytics-tool/rudderstack-default-config.js.map +0 -1
  26. package/lib/react-native/analytics-tool/rudderstack-event-routing.d.ts +0 -6
  27. package/lib/react-native/analytics-tool/rudderstack-event-routing.js +0 -17
  28. package/lib/react-native/analytics-tool/rudderstack-event-routing.js.map +0 -1
  29. package/lib/web/analytics-tool/rudderstack-default-config.d.ts +0 -4
  30. package/lib/web/analytics-tool/rudderstack-default-config.js.map +0 -1
  31. package/lib/web/analytics-tool/rudderstack-event-routing.js +0 -16
  32. package/lib/web/analytics-tool/rudderstack-event-routing.js.map +0 -1
  33. package/lib/web/analytics-tool/web-rudderstack.d.ts +0 -17
  34. package/lib/web/analytics-tool/web-rudderstack.js +0 -76
  35. package/lib/web/analytics-tool/web-rudderstack.js.map +0 -1
  36. package/spec-files/rudderstack-migration/HLD_LLD.md +0 -353
  37. package/spec-files/rudderstack-migration/RUDDERSTACK_SELF_HOSTED_PARAMETERS.md +0 -283
  38. package/spec-files/rudderstack-migration/SEGMENT_VS_RUDDERSTACK_SDK_COMPARISON.md +0 -140
  39. /package/lib/{react-native → node}/analytics-tool/rudderstack-default-config.d.ts +0 -0
  40. /package/lib/{web → node}/analytics-tool/rudderstack-default-config.js +0 -0
  41. /package/lib/{web → node}/analytics-tool/rudderstack-event-routing.d.ts +0 -0
@@ -1,283 +0,0 @@
1
- # RudderStack Self-Hosted Parameters
2
-
3
- This document outlines all parameters and configuration options required for setting up a self-hosted RudderStack solution.
4
-
5
- ## Overview
6
-
7
- RudderStack consists of two main components:
8
- 1. **Control Plane**: Manages source and destination configurations
9
- 2. **Data Plane**: Handles event ingestion, processing, and routing
10
-
11
- ## Control Plane Parameters
12
-
13
- ### Hosted Control Plane (Recommended)
14
-
15
- When using RudderStack's hosted control plane (recommended for most use cases):
16
-
17
- - **Control Plane URL**: `https://app.rudderstack.com` (default)
18
- - **Workspace Token**: Unique identifier linking your data plane to the control plane
19
- - **No Database Required**: Database is managed by RudderStack
20
-
21
- ### Self-Hosted Control Plane (Advanced)
22
-
23
- If self-hosting the control plane:
24
-
25
- - **Control Plane URL**: Your self-hosted control plane endpoint
26
- - **Workspace Token**: Unique identifier for your workspace
27
- - **Database**: PostgreSQL connection string
28
- - `DB_HOST`: Database host address
29
- - `DB_PORT`: Database port (default: 5432)
30
- - `DB_USER`: Database username
31
- - `DB_NAME`: Database name
32
- - `DB_PASSWORD`: Database password
33
- - **Environment Variables**:
34
- - `WORKSPACE_TOKEN`: Workspace token for authentication
35
- - `CONTROL_PLANE_URL`: Self-hosted control plane URL (if applicable)
36
-
37
- ## Data Plane Parameters
38
-
39
- ### Required Parameters
40
-
41
- - **Data Plane URL**: Endpoint where SDK sends events
42
- - Example: `https://dataplane.yourdomain.com`
43
- - Must be accessible from client applications
44
- - Should use HTTPS in production
45
-
46
- - **Write Key**: Source-specific write key for authentication
47
- - Generated in the control plane
48
- - Unique per source
49
- - Used by SDK to authenticate requests
50
-
51
- - **Workspace Token**: Links data plane to control plane
52
- - Required for data plane to fetch configurations
53
- - Generated in the control plane
54
-
55
- ### Database Configuration (PostgreSQL)
56
-
57
- Required for metadata storage and event processing:
58
-
59
- - **DB_HOST**: PostgreSQL host address
60
- - **DB_PORT**: PostgreSQL port (default: 5432)
61
- - **DB_USER**: PostgreSQL username
62
- - **DB_NAME**: PostgreSQL database name
63
- - **DB_PASSWORD**: PostgreSQL password
64
- - **DB_SSL_MODE**: SSL mode (optional, default: require)
65
-
66
- ### Optional Components
67
-
68
- - **Redis**: For caching and queue management
69
- - `REDIS_HOST`: Redis host address
70
- - `REDIS_PORT`: Redis port (default: 6379)
71
- - `REDIS_PASSWORD`: Redis password (if required)
72
- - `REDIS_DB`: Redis database number (default: 0)
73
-
74
- ### Environment Variables for Data Plane
75
-
76
- ```bash
77
- # Database Configuration
78
- DB_HOST=postgres.example.com
79
- DB_PORT=5432
80
- DB_USER=rudderstack
81
- DB_NAME=rudderstack
82
- DB_PASSWORD=your_password
83
- DB_SSL_MODE=require
84
-
85
- # Workspace Configuration
86
- WORKSPACE_TOKEN=your_workspace_token
87
-
88
- # Data Plane Configuration
89
- DATA_PLANE_URL=https://dataplane.yourdomain.com
90
- PORT=8080
91
-
92
- # Optional: Redis Configuration
93
- REDIS_HOST=redis.example.com
94
- REDIS_PORT=6379
95
- REDIS_PASSWORD=your_redis_password
96
-
97
- # Optional: Docker Configuration
98
- DOCKER_IMAGE_TAG=latest
99
- ```
100
-
101
- ## SDK Configuration Parameters
102
-
103
- ### Web SDK (`@rudderstack/rudder-sdk-js`)
104
-
105
- ```typescript
106
- rudderanalytics.load(writeKey, dataPlaneUrl, {
107
- // Anonymous ID Options
108
- anonymousIdOptions: {
109
- autoCapture: {
110
- enabled: true,
111
- source: "segment" // For Segment migration
112
- }
113
- },
114
-
115
- // Flush Settings
116
- flushAt: 20, // Number of events to batch before sending
117
- flushInterval: 5000, // Time in ms to wait before flushing
118
-
119
- // Options
120
- integrations: {
121
- All: true, // Send to all integrations
122
- // Or specify individual integrations
123
- },
124
-
125
- // Other options
126
- logLevel: 'DEBUG', // 'DEBUG' | 'INFO' | 'WARN' | 'ERROR'
127
- secureCookie: true, // Use secure cookies
128
- sameSiteCookie: 'Lax', // Cookie same-site attribute
129
- });
130
- ```
131
-
132
- ### React Native SDK (`@rudderstack/analytics-react-native`)
133
-
134
- ```typescript
135
- const client = RudderClient.getInstance(writeKey, {
136
- dataPlaneUrl: 'YOUR_DATA_PLANE_URL',
137
-
138
- // Flush Settings
139
- flushAt: 3,
140
- flushInterval: 5,
141
-
142
- // Debug
143
- debug: true,
144
-
145
- // Track App Lifecycle
146
- trackAppLifecycleEvents: true,
147
- });
148
- ```
149
-
150
- ## Deployment Options
151
-
152
- ### Docker Deployment
153
-
154
- ```yaml
155
- # docker-compose.yml example
156
- version: '3.8'
157
- services:
158
- rudderstack-data-plane:
159
- image: rudderlabs/rudder-server:latest
160
- environment:
161
- - DB_HOST=postgres
162
- - DB_PORT=5432
163
- - DB_USER=rudderstack
164
- - DB_NAME=rudderstack
165
- - DB_PASSWORD=${DB_PASSWORD}
166
- - WORKSPACE_TOKEN=${WORKSPACE_TOKEN}
167
- - DATA_PLANE_URL=${DATA_PLANE_URL}
168
- ports:
169
- - "8080:8080"
170
- depends_on:
171
- - postgres
172
- - redis
173
-
174
- postgres:
175
- image: postgres:14
176
- environment:
177
- - POSTGRES_USER=rudderstack
178
- - POSTGRES_PASSWORD=${DB_PASSWORD}
179
- - POSTGRES_DB=rudderstack
180
- volumes:
181
- - postgres_data:/var/lib/postgresql/data
182
-
183
- redis:
184
- image: redis:7-alpine
185
- volumes:
186
- - redis_data:/data
187
-
188
- volumes:
189
- postgres_data:
190
- redis_data:
191
- ```
192
-
193
- ### Kubernetes Deployment
194
-
195
- Requires:
196
- - Kubernetes cluster
197
- - Helm charts (if using Helm)
198
- - Persistent volumes for PostgreSQL
199
- - Ingress controller for external access
200
- - ConfigMaps and Secrets for configuration
201
-
202
- ## Network Requirements
203
-
204
- ### Inbound Connections
205
-
206
- - **Data Plane**: Must accept HTTPS connections from client applications
207
- - **Control Plane**: Must be accessible for configuration management (if self-hosted)
208
-
209
- ### Outbound Connections
210
-
211
- - **Data Plane** → **Control Plane**: To fetch source/destination configurations
212
- - **Data Plane** → **Destinations**: To forward events to configured destinations
213
- - **Data Plane** → **PostgreSQL**: Database connections
214
- - **Data Plane** → **Redis**: Cache/queue connections (if used)
215
-
216
- ## Security Considerations
217
-
218
- 1. **HTTPS**: Always use HTTPS for data plane URL in production
219
- 2. **Write Key**: Keep write keys secure, rotate regularly
220
- 3. **Workspace Token**: Treat as sensitive credential
221
- 4. **Database**: Use strong passwords, enable SSL
222
- 5. **Network**: Restrict access to data plane endpoint
223
- 6. **Firewall**: Configure firewall rules appropriately
224
-
225
- ## Monitoring and Observability
226
-
227
- ### Metrics to Monitor
228
-
229
- - Event ingestion rate
230
- - Event processing latency
231
- - Destination delivery success/failure rates
232
- - Database connection pool usage
233
- - Redis memory usage (if applicable)
234
- - Error rates
235
-
236
- ### Logging
237
-
238
- - Application logs
239
- - Access logs
240
- - Error logs
241
- - Audit logs for configuration changes
242
-
243
- ## Configuration Summary
244
-
245
- ### Minimum Required for PoC
246
-
247
- 1. **Control Plane**: Use hosted control plane (no setup required)
248
- 2. **Data Plane**:
249
- - Data Plane URL
250
- - Write Key
251
- - Workspace Token
252
- - PostgreSQL database
253
- 3. **SDK Configuration**:
254
- - Write Key
255
- - Data Plane URL
256
-
257
- ### Production Requirements
258
-
259
- 1. **Control Plane**: Hosted or self-hosted with proper security
260
- 2. **Data Plane**:
261
- - All minimum requirements
262
- - Redis (recommended for production)
263
- - High availability setup
264
- - Monitoring and alerting
265
- - Backup and disaster recovery
266
- 3. **SDK Configuration**:
267
- - All minimum requirements
268
- - Proper error handling
269
- - Retry logic
270
- - Batching configuration
271
-
272
- ## Parameter Checklist
273
-
274
- - [ ] Data Plane URL configured and accessible
275
- - [ ] Write Key generated in control plane
276
- - [ ] Workspace Token obtained
277
- - [ ] PostgreSQL database set up and accessible
278
- - [ ] Redis configured (optional but recommended)
279
- - [ ] Network security configured
280
- - [ ] SSL/TLS certificates configured
281
- - [ ] Monitoring and logging set up
282
- - [ ] Backup strategy in place
283
-
@@ -1,140 +0,0 @@
1
- # Segment vs RudderStack SDK Comparison
2
-
3
- This document provides a comprehensive comparison between Segment and RudderStack client SDKs for Web and React Native platforms.
4
-
5
- ## Web SDK Comparison
6
-
7
- | Feature | Segment | RudderStack | Notes |
8
- |---------|---------|-------------|-------|
9
- | **Core Methods** | | | |
10
- | `identify()` | ✅ | ✅ | API compatible - both accept userId and traits |
11
- | `track()` | ✅ | ✅ | API compatible - both accept event name and properties |
12
- | `page()` | ✅ | ✅ | API compatible - both accept page name and properties |
13
- | `group()` | ✅ | ✅ | API compatible - both support group identification |
14
- | `alias()` | ✅ | ✅ | API compatible - both support user aliasing |
15
- | **Additional Features** | | | |
16
- | Session Tracking | ❌ | ✅ | RudderStack has built-in configurable sessions |
17
- | Ad Blocker Detection | ❌ | ✅ | RudderStack automatically detects ad blockers |
18
- | Anonymous ID Sync | N/A | ✅ | RudderStack can capture Segment's anonymousId |
19
- | **Initialization** | `AnalyticsBrowser.load({ writeKey })` | `rudderanalytics.load(writeKey, dataPlaneUrl)` | RudderStack requires data plane URL |
20
- | **Configuration** | Write Key only | Write Key + Data Plane URL | RudderStack requires self-hosted data plane endpoint |
21
- | **Package** | `@segment/analytics-next` | `@rudderstack/rudder-sdk-js` | Different npm packages |
22
- | **User Management** | `client.user().traits()`, `client.user().anonymousId()` | `rudderanalytics.getUserTraits()`, `rudderanalytics.getAnonymousId()` | Similar functionality, different API |
23
- | **Options Support** | ✅ | ✅ | Both support options and callbacks |
24
- | **Debug Mode** | ✅ | ✅ | Both support debug logging |
25
-
26
- ### Segment Web SDK Example
27
-
28
- ```typescript
29
- import { AnalyticsBrowser } from '@segment/analytics-next';
30
-
31
- const client = AnalyticsBrowser.load({ writeKey: 'YOUR_WRITE_KEY' });
32
-
33
- await client.track('Event Name', { property: 'value' });
34
- await client.identify('userId', { email: 'user@example.com' });
35
- await client.page('Page Name', { path: '/home' });
36
- const anonymousId = await client.user().anonymousId();
37
- ```
38
-
39
- ### RudderStack Web SDK Example
40
-
41
- ```typescript
42
- import * as rudderanalytics from '@rudderstack/rudder-sdk-js';
43
-
44
- rudderanalytics.load('YOUR_WRITE_KEY', 'YOUR_DATA_PLANE_URL');
45
-
46
- rudderanalytics.track('Event Name', { property: 'value' });
47
- rudderanalytics.identify('userId', { email: 'user@example.com' });
48
- rudderanalytics.page('Page Name', { path: '/home' });
49
- const anonymousId = rudderanalytics.getAnonymousId();
50
- ```
51
-
52
- ## React Native SDK Comparison
53
-
54
- | Feature | Segment | RudderStack | Notes |
55
- |---------|---------|-------------|-------|
56
- | **Core Methods** | | | |
57
- | `identify()` | ✅ | ✅ | API compatible - both accept userId and traits |
58
- | `track()` | ✅ | ✅ | API compatible - both accept event name and properties |
59
- | `screen()` | ✅ | ✅ | API compatible - both accept screen name and properties |
60
- | `group()` | ✅ | ✅ | API compatible - both support group identification |
61
- | `alias()` | ✅ | ✅ | API compatible - both support user aliasing |
62
- | **Initialization** | `createClient({ writeKey })` | `RudderClient.getInstance(writeKey, dataPlaneUrl)` | RudderStack requires data plane URL |
63
- | **Configuration** | Write Key only | Write Key + Data Plane URL | RudderStack requires self-hosted data plane endpoint |
64
- | **Package** | `@segment/analytics-react-native` | `@rudderstack/analytics-react-native` | Different npm packages |
65
- | **Flush Settings** | `flushAt`, `flushInterval` | `flushAt`, `flushInterval` | Both support batching configuration |
66
- | **Debug Mode** | ✅ | ✅ | Both support debug logging |
67
- | **App Lifecycle Events** | ✅ (trackAppLifecycleEvents) | ✅ | Both can track app lifecycle automatically |
68
-
69
- ### Segment React Native SDK Example
70
-
71
- ```typescript
72
- import { createClient } from '@segment/analytics-react-native';
73
-
74
- const client = createClient({
75
- writeKey: 'YOUR_WRITE_KEY',
76
- trackAppLifecycleEvents: true,
77
- flushAt: 3,
78
- flushInterval: 5,
79
- });
80
-
81
- await client.track('Event Name', { property: 'value' });
82
- await client.identify('userId', { email: 'user@example.com' });
83
- await client.screen('Screen Name', { screen: 'Home' });
84
- ```
85
-
86
- ### RudderStack React Native SDK Example
87
-
88
- ```typescript
89
- import { RudderClient } from '@rudderstack/analytics-react-native';
90
-
91
- const client = RudderClient.getInstance('YOUR_WRITE_KEY', {
92
- dataPlaneUrl: 'YOUR_DATA_PLANE_URL',
93
- flushAt: 3,
94
- flushInterval: 5,
95
- });
96
-
97
- client.track('Event Name', { property: 'value' });
98
- client.identify('userId', { email: 'user@example.com' });
99
- client.screen('Screen Name', { screen: 'Home' });
100
- ```
101
-
102
- ## Key Differences Summary
103
-
104
- ### 1. **Data Plane Requirement**
105
- - **Segment**: Uses Segment's hosted infrastructure. Only requires write key.
106
- - **RudderStack**: Requires self-hosted data plane URL in addition to write key for self-hosted deployments.
107
-
108
- ### 2. **Session Tracking**
109
- - **Segment**: Does not have built-in session tracking. Requires custom implementation.
110
- - **RudderStack**: Has built-in session tracking that can be configured.
111
-
112
- ### 3. **Ad Blocker Detection**
113
- - **Segment**: Does not detect ad blockers.
114
- - **RudderStack**: Automatically detects ad blockers and can send event flags accordingly.
115
-
116
- ### 4. **Anonymous ID Synchronization**
117
- - **Segment**: N/A (source of truth).
118
- - **RudderStack**: Can automatically capture and sync anonymousId from Segment during migration.
119
-
120
- ### 5. **API Compatibility**
121
- - Both SDKs are designed to be API-compatible, making migration easier.
122
- - Method signatures are similar but not identical.
123
- - RudderStack requires data plane URL parameter during initialization.
124
-
125
- ## Migration Considerations
126
-
127
- 1. **Initialization Changes**: RudderStack requires data plane URL parameter
128
- 2. **Method Calls**: Method signatures are compatible, but some helper methods differ
129
- 3. **User Management**: Different APIs for accessing user traits and anonymous ID
130
- 4. **Configuration**: RudderStack requires additional configuration for self-hosted setup
131
- 5. **Error Handling**: Both support error handling, but implementation details differ
132
-
133
- ## Compatibility Notes
134
-
135
- - Both SDKs support the same core tracking methods (identify, track, page/screen)
136
- - Event payload structures are compatible
137
- - Both support custom properties and traits
138
- - Both support options and callbacks
139
- - RudderStack can sync anonymousId from Segment for seamless migration
140
-