@athena-tracker/tracker 1.0.0 → 1.0.2
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.
- package/README.md +171 -245
- package/dist/index.d.ts +106 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +149 -2834
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +157 -2842
- package/dist/index.js.map +1 -1
- package/package.json +14 -56
- package/dist/events/capture-react-native.d.ts +0 -77
- package/dist/events/capture-react-native.d.ts.map +0 -1
- package/dist/inference/auto-detect.d.ts +0 -21
- package/dist/inference/auto-detect.d.ts.map +0 -1
- package/dist/inference/on-device.d.ts +0 -36
- package/dist/inference/on-device.d.ts.map +0 -1
- package/dist/inference/server.d.ts +0 -30
- package/dist/inference/server.d.ts.map +0 -1
- package/dist/react-native/ForcedReloadWrapper.d.ts +0 -26
- package/dist/react-native/ForcedReloadWrapper.d.ts.map +0 -1
- package/dist/tracker.d.ts +0 -82
- package/dist/tracker.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -96
- package/dist/types/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,317 +1,243 @@
|
|
|
1
|
-
# @athena/tracker
|
|
1
|
+
# @athena-tracker/tracker
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- ✅ 90+ behavioral event types auto-captured
|
|
8
|
-
- ✅ On-device ML inference (<10ms latency)
|
|
9
|
-
- ✅ Server-side fallback for OTA apps
|
|
10
|
-
- ✅ Works on Web, iOS, Android
|
|
11
|
-
- ✅ Zero configuration required
|
|
12
|
-
- ✅ TypeScript support
|
|
3
|
+
ATHENA Analytics tracker SDK wrapper for easy integration
|
|
13
4
|
|
|
14
5
|
## Installation
|
|
15
6
|
|
|
16
7
|
```bash
|
|
17
|
-
npm install @athena/tracker
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
### For React Native with On-Device Inference
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
npm install @athena/tracker onnxruntime-react-native
|
|
8
|
+
npm install @athena-tracker/tracker
|
|
24
9
|
```
|
|
25
10
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install @athena/tracker
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
(No `onnxruntime-react-native` required - will automatically fall back to server-side inference)
|
|
33
|
-
|
|
34
|
-
## Quick Start
|
|
11
|
+
## Usage
|
|
35
12
|
|
|
36
|
-
###
|
|
13
|
+
### Basic Setup
|
|
37
14
|
|
|
38
15
|
```typescript
|
|
39
|
-
import
|
|
16
|
+
import { initTracker, identify, track, page } from '@athena-tracker/tracker';
|
|
17
|
+
|
|
18
|
+
// Initialize the tracker
|
|
19
|
+
const tracker = initTracker({
|
|
20
|
+
projectId: 'your-project-id',
|
|
21
|
+
apiKey: 'your-api-key',
|
|
22
|
+
sampleRate: 1.0, // Track 100% of sessions
|
|
23
|
+
recording: {
|
|
24
|
+
enabled: true,
|
|
25
|
+
sampleRate: 0.1, // Record 10% of sessions
|
|
26
|
+
maskAllInputs: true,
|
|
27
|
+
},
|
|
28
|
+
edgeAI: {
|
|
29
|
+
enabled: true,
|
|
30
|
+
webhook: {
|
|
31
|
+
url: 'https://your-backend.com/webhooks/athena',
|
|
32
|
+
enabled: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
});
|
|
40
36
|
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
// Load the tracker script
|
|
38
|
+
await tracker.load();
|
|
39
|
+
|
|
40
|
+
// Identify user
|
|
41
|
+
identify('user-123', {
|
|
42
|
+
email: 'user@example.com',
|
|
43
|
+
name: 'John Doe',
|
|
44
|
+
plan: 'pro',
|
|
49
45
|
});
|
|
50
|
-
```
|
|
51
46
|
|
|
52
|
-
|
|
47
|
+
// Track custom events
|
|
48
|
+
track('button_clicked', {
|
|
49
|
+
buttonId: 'cta-signup',
|
|
50
|
+
location: 'homepage',
|
|
51
|
+
});
|
|
53
52
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
projectId: 'your-app-token',
|
|
59
|
-
edgeAI: {
|
|
60
|
-
enabled: true,
|
|
61
|
-
modelPath: 'https://tracker.pascal.cx/models/base_model_int8.onnx'
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
</script>
|
|
53
|
+
// Track page views
|
|
54
|
+
page('Home Page', {
|
|
55
|
+
category: 'marketing',
|
|
56
|
+
});
|
|
65
57
|
```
|
|
66
58
|
|
|
67
|
-
|
|
59
|
+
### React Integration
|
|
68
60
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
61
|
+
```tsx
|
|
62
|
+
import React, { useEffect } from 'react';
|
|
63
|
+
import { initTracker } from '@athena-tracker/tracker';
|
|
64
|
+
|
|
65
|
+
function App() {
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
const tracker = initTracker({
|
|
68
|
+
projectId: 'your-project-id',
|
|
69
|
+
apiKey: 'your-api-key',
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
tracker.load().then(() => {
|
|
73
|
+
console.log('ATHENA tracker loaded');
|
|
74
|
+
});
|
|
75
|
+
}, []);
|
|
76
|
+
|
|
77
|
+
return <div>Your App</div>;
|
|
81
78
|
}
|
|
82
79
|
```
|
|
83
80
|
|
|
84
|
-
###
|
|
81
|
+
### Next.js Integration
|
|
85
82
|
|
|
86
|
-
|
|
83
|
+
```tsx
|
|
84
|
+
// pages/_app.tsx
|
|
85
|
+
import { useEffect } from 'react';
|
|
86
|
+
import { initTracker } from '@athena-tracker/tracker';
|
|
87
|
+
|
|
88
|
+
function MyApp({ Component, pageProps }) {
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (typeof window !== 'undefined') {
|
|
91
|
+
const tracker = initTracker({
|
|
92
|
+
projectId: process.env.NEXT_PUBLIC_ATHENA_PROJECT_ID,
|
|
93
|
+
apiKey: process.env.NEXT_PUBLIC_ATHENA_API_KEY,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
tracker.load();
|
|
97
|
+
}
|
|
98
|
+
}, []);
|
|
87
99
|
|
|
88
|
-
|
|
100
|
+
return <Component {...pageProps} />;
|
|
101
|
+
}
|
|
89
102
|
|
|
90
|
-
|
|
91
|
-
AthenaTracker.init({
|
|
92
|
-
appToken: 'at_live_xxxxx',
|
|
93
|
-
inferenceMode: 'auto' // Default
|
|
94
|
-
});
|
|
103
|
+
export default MyApp;
|
|
95
104
|
```
|
|
96
105
|
|
|
97
|
-
|
|
106
|
+
### Vue.js Integration
|
|
98
107
|
|
|
99
|
-
|
|
108
|
+
```javascript
|
|
109
|
+
// main.js
|
|
110
|
+
import { createApp } from 'vue';
|
|
111
|
+
import { initTracker } from '@athena-tracker/tracker';
|
|
112
|
+
import App from './App.vue';
|
|
100
113
|
|
|
101
|
-
|
|
102
|
-
AthenaTracker.init({
|
|
103
|
-
appToken: 'at_live_xxxxx',
|
|
104
|
-
inferenceMode: 'on-device',
|
|
105
|
-
modelPath: '/path/to/model.onnx'
|
|
106
|
-
});
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
#### Server Mode (Forced)
|
|
110
|
-
|
|
111
|
-
Force server-side inference:
|
|
114
|
+
const app = createApp(App);
|
|
112
115
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
serverInferenceUrl: 'https://api.pascal.cx/v1/predict'
|
|
116
|
+
// Initialize tracker
|
|
117
|
+
const tracker = initTracker({
|
|
118
|
+
projectId: import.meta.env.VITE_ATHENA_PROJECT_ID,
|
|
119
|
+
apiKey: import.meta.env.VITE_ATHENA_API_KEY,
|
|
118
120
|
});
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Webhook Integration
|
|
122
|
-
|
|
123
|
-
Receive real-time predictions via webhooks:
|
|
124
121
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
appToken: 'at_live_xxxxx',
|
|
128
|
-
webhook: {
|
|
129
|
-
url: 'https://your-backend.com/webhooks/athena',
|
|
130
|
-
enabled: true,
|
|
131
|
-
retry: {
|
|
132
|
-
maxAttempts: 3,
|
|
133
|
-
backoffMs: 1000
|
|
134
|
-
}
|
|
135
|
-
}
|
|
122
|
+
tracker.load().then(() => {
|
|
123
|
+
console.log('ATHENA tracker loaded');
|
|
136
124
|
});
|
|
137
|
-
```
|
|
138
125
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
```json
|
|
142
|
-
{
|
|
143
|
-
"user_id": "user_abc",
|
|
144
|
-
"session_id": "sess_123",
|
|
145
|
-
"predicted_class": "engaged_explorer",
|
|
146
|
-
"confidence": 0.85,
|
|
147
|
-
"archetype": "on_track",
|
|
148
|
-
"purchase_intent": 0.72,
|
|
149
|
-
"cart_abandonment_risk": 0.15,
|
|
150
|
-
"recommended_action": "Show 10% discount offer",
|
|
151
|
-
"urgency": "high",
|
|
152
|
-
"trigger_reason": "High-value cart ($249), 80% scroll depth, 45s time-on-page",
|
|
153
|
-
"timestamp": "2026-02-24T12:34:56Z"
|
|
154
|
-
}
|
|
126
|
+
app.mount('#app');
|
|
155
127
|
```
|
|
156
128
|
|
|
157
|
-
## User Archetypes
|
|
158
|
-
|
|
159
|
-
| Archetype | Description | Similarity Score |
|
|
160
|
-
|-----------|-------------|------------------|
|
|
161
|
-
| **fast_mover** | High purchase intent, quick decision-maker | >85% |
|
|
162
|
-
| **on_track** | Steady browsing, likely to convert | 60-85% |
|
|
163
|
-
| **slow_adopter** | Needs guidance, price-sensitive | 40-60% |
|
|
164
|
-
| **at_risk** | Low engagement, high abandonment risk | <40% |
|
|
165
|
-
| **different_path** | Unconventional browsing pattern | Unique |
|
|
166
|
-
|
|
167
129
|
## API Reference
|
|
168
130
|
|
|
169
|
-
###
|
|
131
|
+
### `initTracker(config)`
|
|
170
132
|
|
|
171
|
-
|
|
172
|
-
class AthenaTracker {
|
|
173
|
-
static init(config: AthenaConfig): Promise<void>
|
|
174
|
-
static identify(userId: string, traits?: Record<string, any>): void
|
|
175
|
-
static track(eventType: string, properties?: Record<string, any>): void
|
|
176
|
-
static getInferenceMode(): 'on-device' | 'server' | null
|
|
177
|
-
static getSessionId(): string | null
|
|
178
|
-
}
|
|
179
|
-
```
|
|
133
|
+
Initialize the ATHENA tracker with configuration.
|
|
180
134
|
|
|
181
|
-
|
|
135
|
+
**Parameters:**
|
|
136
|
+
- `config.projectId` (required): Your ATHENA project ID
|
|
137
|
+
- `config.apiKey` (required): Your ATHENA API key
|
|
138
|
+
- `config.apiUrl` (optional): API endpoint URL (default: 'https://tracker.pascal.cx')
|
|
139
|
+
- `config.sampleRate` (optional): Session sampling rate 0.0-1.0 (default: 1.0)
|
|
140
|
+
- `config.recording` (optional): Recording configuration
|
|
141
|
+
- `enabled`: Enable session recording (default: true)
|
|
142
|
+
- `sampleRate`: Recording sampling rate 0.0-1.0 (default: 0.1)
|
|
143
|
+
- `maskAllInputs`: Mask all input fields (default: true)
|
|
144
|
+
- `maskInputOptions`: Specific input masking options
|
|
145
|
+
- `config.edgeAI` (optional): Edge AI configuration
|
|
146
|
+
- `enabled`: Enable client-side ML predictions (default: true)
|
|
147
|
+
- `modelPath`: Custom ONNX model path
|
|
148
|
+
- `webhook`: Webhook configuration
|
|
182
149
|
|
|
183
|
-
|
|
150
|
+
**Returns:** `AthenaTrackerSDK` instance
|
|
184
151
|
|
|
185
|
-
|
|
152
|
+
### `tracker.load()`
|
|
186
153
|
|
|
187
|
-
|
|
188
|
-
await AthenaTracker.init({
|
|
189
|
-
appToken: 'at_live_xxxxx'
|
|
190
|
-
});
|
|
191
|
-
```
|
|
154
|
+
Load the ATHENA tracker script asynchronously.
|
|
192
155
|
|
|
193
|
-
|
|
156
|
+
**Returns:** `Promise<void>`
|
|
194
157
|
|
|
195
|
-
|
|
158
|
+
### `identify(userId, properties?)`
|
|
196
159
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
```
|
|
160
|
+
Identify a user with optional properties.
|
|
161
|
+
|
|
162
|
+
**Parameters:**
|
|
163
|
+
- `userId`: Unique user identifier
|
|
164
|
+
- `properties`: Optional user properties (email, name, etc.)
|
|
203
165
|
|
|
204
|
-
|
|
166
|
+
### `track(eventName, properties?)`
|
|
205
167
|
|
|
206
168
|
Track a custom event.
|
|
207
169
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
page: '/cart'
|
|
212
|
-
});
|
|
213
|
-
```
|
|
170
|
+
**Parameters:**
|
|
171
|
+
- `eventName`: Name of the event
|
|
172
|
+
- `properties`: Optional event properties
|
|
214
173
|
|
|
215
|
-
|
|
174
|
+
### `page(pageName?, properties?)`
|
|
216
175
|
|
|
217
|
-
|
|
176
|
+
Track a page view.
|
|
218
177
|
|
|
219
|
-
|
|
178
|
+
**Parameters:**
|
|
179
|
+
- `pageName`: Optional page name
|
|
180
|
+
- `properties`: Optional page properties
|
|
220
181
|
|
|
221
|
-
|
|
222
|
-
import { AthenaOTAWrapper } from '@athena/tracker';
|
|
223
|
-
|
|
224
|
-
export default function App() {
|
|
225
|
-
return (
|
|
226
|
-
<AthenaOTAWrapper
|
|
227
|
-
loadingMessage="Loading..."
|
|
228
|
-
updateMessage="Updating..."
|
|
229
|
-
>
|
|
230
|
-
<YourApp />
|
|
231
|
-
</AthenaOTAWrapper>
|
|
232
|
-
);
|
|
233
|
-
}
|
|
234
|
-
```
|
|
182
|
+
### `reset()`
|
|
235
183
|
|
|
236
|
-
|
|
237
|
-
- Checks for OTA updates on app launch
|
|
238
|
-
- Fetches and applies updates automatically
|
|
239
|
-
- Forces immediate reload (<2 seconds)
|
|
240
|
-
- Displays loading spinner during update
|
|
184
|
+
Reset user identity (useful for logout).
|
|
241
185
|
|
|
242
|
-
|
|
243
|
-
- `loadingMessage` (string, optional): Message during initial load (default: "Loading...")
|
|
244
|
-
- `updateMessage` (string, optional): Message during update (default: "Updating...")
|
|
186
|
+
### `getSessionId()`
|
|
245
187
|
|
|
246
|
-
|
|
188
|
+
Get the current session ID.
|
|
247
189
|
|
|
248
|
-
|
|
190
|
+
**Returns:** `string | null`
|
|
249
191
|
|
|
250
|
-
|
|
192
|
+
### `getUserId()`
|
|
251
193
|
|
|
252
|
-
|
|
253
|
-
import { ReactNativeEventCapture } from '@athena/tracker';
|
|
254
|
-
|
|
255
|
-
const capture = new ReactNativeEventCapture({
|
|
256
|
-
captureTouch: true,
|
|
257
|
-
captureNavigation: true,
|
|
258
|
-
captureLifecycle: true,
|
|
259
|
-
captureNetworkErrors: true,
|
|
260
|
-
batchSize: 10,
|
|
261
|
-
batchIntervalMs: 10000
|
|
262
|
-
});
|
|
194
|
+
Get the current user ID.
|
|
263
195
|
|
|
264
|
-
|
|
265
|
-
capture.start();
|
|
196
|
+
**Returns:** `string | null`
|
|
266
197
|
|
|
267
|
-
|
|
268
|
-
capture.trackScreenView('ProductDetails', { productId: '123' });
|
|
198
|
+
## Configuration Options
|
|
269
199
|
|
|
270
|
-
|
|
271
|
-
capture.track('AddToCart', { productId: '123', price: 49.99 });
|
|
200
|
+
### Session Recording
|
|
272
201
|
|
|
273
|
-
|
|
274
|
-
|
|
202
|
+
```typescript
|
|
203
|
+
recording: {
|
|
204
|
+
enabled: true, // Enable recording
|
|
205
|
+
sampleRate: 0.1, // Record 10% of sessions
|
|
206
|
+
maskAllInputs: true, // Mask all input fields
|
|
207
|
+
maskInputOptions: {
|
|
208
|
+
password: true, // Mask password fields
|
|
209
|
+
email: true, // Mask email fields
|
|
210
|
+
},
|
|
211
|
+
compressionLevel: 6, // Compression level (1-9)
|
|
212
|
+
maxChunkSize: 102400, // Max chunk size in bytes
|
|
213
|
+
}
|
|
275
214
|
```
|
|
276
215
|
|
|
277
|
-
|
|
278
|
-
- `captureTouch` (boolean): Capture touch events (Tap, Swipe, LongPress)
|
|
279
|
-
- `captureNavigation` (boolean): Capture screen navigation
|
|
280
|
-
- `captureLifecycle` (boolean): Capture app lifecycle (Open, Background, Foreground)
|
|
281
|
-
- `captureNetworkErrors` (boolean): Capture failed network requests
|
|
282
|
-
- `batchSize` (number): Events per batch (default: 10)
|
|
283
|
-
- `batchIntervalMs` (number): Batch interval in milliseconds (default: 10000)
|
|
284
|
-
|
|
285
|
-
**Captured Events:**
|
|
286
|
-
- `AppOpen`, `AppForeground`, `AppBackground`, `AppInactive`
|
|
287
|
-
- `Tap`, `Swipe`, `LongPress`
|
|
288
|
-
- `ScreenView`
|
|
289
|
-
- `NetworkError`
|
|
216
|
+
### Edge AI
|
|
290
217
|
|
|
291
|
-
|
|
218
|
+
```typescript
|
|
219
|
+
edgeAI: {
|
|
220
|
+
enabled: true,
|
|
221
|
+
modelPath: 'https://tracker.pascal.cx/models/base_model_int8.onnx',
|
|
222
|
+
webhook: {
|
|
223
|
+
url: 'https://your-backend.com/webhooks/athena',
|
|
224
|
+
enabled: true,
|
|
225
|
+
},
|
|
226
|
+
}
|
|
227
|
+
```
|
|
292
228
|
|
|
293
|
-
|
|
294
|
-
- **On-device inference latency**: <10ms P95
|
|
295
|
-
- **Server-side inference latency**: <100ms P95
|
|
296
|
-
- **Memory overhead**: <50MB
|
|
297
|
-
- **Battery impact**: Negligible (<1%)
|
|
229
|
+
## TypeScript Support
|
|
298
230
|
|
|
299
|
-
|
|
231
|
+
Full TypeScript support with type definitions included.
|
|
300
232
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
233
|
+
```typescript
|
|
234
|
+
import type {
|
|
235
|
+
AthenaTrackerConfig,
|
|
236
|
+
UserProperties,
|
|
237
|
+
EventProperties,
|
|
238
|
+
} from '@athena-tracker/tracker';
|
|
239
|
+
```
|
|
305
240
|
|
|
306
241
|
## License
|
|
307
242
|
|
|
308
243
|
MIT
|
|
309
|
-
|
|
310
|
-
## Documentation
|
|
311
|
-
|
|
312
|
-
Full documentation: https://docs.athena.ai/tracker
|
|
313
|
-
|
|
314
|
-
## Support
|
|
315
|
-
|
|
316
|
-
- Issues: https://github.com/RubaiyatF/Pascal/issues
|
|
317
|
-
- Email: support@pascal.cx
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,108 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @athena/tracker
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
* @athena-tracker/tracker
|
|
3
|
+
* ATHENA Analytics tracker SDK wrapper
|
|
4
|
+
*/
|
|
5
|
+
export interface AthenaTrackerConfig {
|
|
6
|
+
projectId: string;
|
|
7
|
+
apiKey: string;
|
|
8
|
+
apiUrl?: string;
|
|
9
|
+
sampleRate?: number;
|
|
10
|
+
recording?: {
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
sampleRate?: number;
|
|
13
|
+
maskAllInputs?: boolean;
|
|
14
|
+
maskInputOptions?: {
|
|
15
|
+
password?: boolean;
|
|
16
|
+
email?: boolean;
|
|
17
|
+
};
|
|
18
|
+
compressionLevel?: number;
|
|
19
|
+
maxChunkSize?: number;
|
|
20
|
+
};
|
|
21
|
+
edgeAI?: {
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
modelPath?: string;
|
|
24
|
+
webhook?: {
|
|
25
|
+
url?: string;
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface UserProperties {
|
|
31
|
+
email?: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}
|
|
35
|
+
export interface EventProperties {
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
}
|
|
38
|
+
declare class AthenaTrackerSDK {
|
|
39
|
+
private config;
|
|
40
|
+
private scriptLoaded;
|
|
41
|
+
private loadPromise;
|
|
42
|
+
constructor(config: AthenaTrackerConfig);
|
|
43
|
+
/**
|
|
44
|
+
* Load the ATHENA tracker script dynamically
|
|
45
|
+
*/
|
|
46
|
+
load(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Initialize the tracker with configuration
|
|
49
|
+
*/
|
|
50
|
+
private initialize;
|
|
51
|
+
/**
|
|
52
|
+
* Get the underlying tracker instance
|
|
53
|
+
*/
|
|
54
|
+
private getTracker;
|
|
55
|
+
/**
|
|
56
|
+
* Identify a user
|
|
57
|
+
*/
|
|
58
|
+
identify(userId: string, properties?: UserProperties): void;
|
|
59
|
+
/**
|
|
60
|
+
* Track a custom event
|
|
61
|
+
*/
|
|
62
|
+
track(eventName: string, properties?: EventProperties): void;
|
|
63
|
+
/**
|
|
64
|
+
* Track a page view
|
|
65
|
+
*/
|
|
66
|
+
page(pageName?: string, properties?: EventProperties): void;
|
|
67
|
+
/**
|
|
68
|
+
* Reset user identity (logout)
|
|
69
|
+
*/
|
|
70
|
+
reset(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get current session ID
|
|
73
|
+
*/
|
|
74
|
+
getSessionId(): string | null;
|
|
75
|
+
/**
|
|
76
|
+
* Get current user ID
|
|
77
|
+
*/
|
|
78
|
+
getUserId(): string | null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Initialize ATHENA tracker
|
|
82
|
+
*/
|
|
83
|
+
export declare function initTracker(config: AthenaTrackerConfig): AthenaTrackerSDK;
|
|
84
|
+
/**
|
|
85
|
+
* Get the tracker instance
|
|
86
|
+
*/
|
|
87
|
+
export declare function getTracker(): AthenaTrackerSDK | null;
|
|
88
|
+
/**
|
|
89
|
+
* Convenience methods (use singleton instance)
|
|
90
|
+
*/
|
|
91
|
+
export declare function identify(userId: string, properties?: UserProperties): void;
|
|
92
|
+
export declare function track(eventName: string, properties?: EventProperties): void;
|
|
93
|
+
export declare function page(pageName?: string, properties?: EventProperties): void;
|
|
94
|
+
export declare function reset(): void;
|
|
95
|
+
export declare function getSessionId(): string | null;
|
|
96
|
+
export declare function getUserId(): string | null;
|
|
97
|
+
declare const _default: {
|
|
98
|
+
initTracker: typeof initTracker;
|
|
99
|
+
getTracker: typeof getTracker;
|
|
100
|
+
identify: typeof identify;
|
|
101
|
+
track: typeof track;
|
|
102
|
+
page: typeof page;
|
|
103
|
+
reset: typeof reset;
|
|
104
|
+
getSessionId: typeof getSessionId;
|
|
105
|
+
getUserId: typeof getUserId;
|
|
106
|
+
};
|
|
107
|
+
export default _default;
|
|
13
108
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,gBAAgB,CAAC,EAAE;YACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;YACnB,KAAK,CAAC,EAAE,OAAO,CAAC;SACjB,CAAC;QACF,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,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