@journium/js 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 +154 -274
- package/dist/JourniumAnalytics.d.ts +26 -0
- package/dist/JourniumAnalytics.d.ts.map +1 -0
- package/dist/JourniumClient.d.ts +25 -0
- package/dist/JourniumClient.d.ts.map +1 -0
- package/dist/autocapture.d.ts +4 -16
- package/dist/autocapture.d.ts.map +1 -1
- package/dist/client.d.ts +10 -8
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +149 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +147 -147
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +150 -150
- package/dist/index.umd.js.map +1 -1
- package/dist/journium.d.ts +9 -12
- package/dist/journium.d.ts.map +1 -1
- package/dist/pageview.d.ts +4 -4
- package/dist/pageview.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -8,359 +8,239 @@
|
|
|
8
8
|
|
|
9
9
|
Track events, pageviews, and user interactions with ease. Perfect for SPAs, vanilla JavaScript apps, and any web application.
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
### Installation
|
|
11
|
+
## Installation
|
|
14
12
|
|
|
13
|
+
### npm
|
|
15
14
|
```bash
|
|
16
15
|
npm install @journium/js
|
|
17
16
|
```
|
|
18
17
|
|
|
19
|
-
###
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import { init } from '@journium/js';
|
|
23
|
-
|
|
24
|
-
// Initialize Journium
|
|
25
|
-
const journium = init({
|
|
26
|
-
token: 'your-journium-token',
|
|
27
|
-
apiHost: 'https://your-journium-instance.com'
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// Track events
|
|
31
|
-
journium.track('button_clicked', {
|
|
32
|
-
button_name: 'signup',
|
|
33
|
-
page: 'homepage'
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Track pageviews (optional - can be automatic)
|
|
37
|
-
journium.capturePageview();
|
|
38
|
-
|
|
39
|
-
// Start auto-capture - automatically enabled when calling startAutoCapture()
|
|
40
|
-
// Autocapture is enabled by default, but you need to start it:
|
|
41
|
-
journium.startAutoCapture();
|
|
18
|
+
### pnpm
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @journium/js
|
|
42
21
|
```
|
|
43
22
|
|
|
44
|
-
|
|
23
|
+
### yarn
|
|
24
|
+
```bash
|
|
25
|
+
yarn add @journium/js
|
|
26
|
+
```
|
|
45
27
|
|
|
46
|
-
|
|
28
|
+
## Basic Setup
|
|
47
29
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Initialize the Journium SDK with your configuration.
|
|
30
|
+
### Initialize Journium
|
|
31
|
+
Initialize the Journium SDK with your publishable key to start tracking events.
|
|
51
32
|
|
|
52
33
|
```javascript
|
|
34
|
+
import { init } from '@journium/js';
|
|
35
|
+
|
|
53
36
|
const journium = init({
|
|
54
|
-
|
|
55
|
-
apiHost: 'https://api.journium.com', // Required: Your API endpoint
|
|
56
|
-
debug: false, // Optional: Enable debug logs
|
|
57
|
-
flushAt: 20, // Optional: Flush after N events
|
|
58
|
-
flushInterval: 10000, // Optional: Flush interval (ms)
|
|
59
|
-
autocapture: true, // Optional: (default: true) - set false to disable
|
|
60
|
-
sessionTimeout: 1800000 // Optional: Session timeout (30m)
|
|
37
|
+
publishableKey: 'your-journium-publishable-key'
|
|
61
38
|
});
|
|
62
39
|
```
|
|
63
40
|
|
|
64
|
-
### Event
|
|
65
|
-
|
|
66
|
-
#### `journium.track(eventName, properties?)`
|
|
67
|
-
|
|
68
|
-
Track custom events with optional properties.
|
|
41
|
+
### Track a Custom Event
|
|
42
|
+
Track user actions and business events with custom properties.
|
|
69
43
|
|
|
70
44
|
```javascript
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
journium.track('purchase_completed', {
|
|
76
|
-
product_id: 'prod_123',
|
|
77
|
-
amount: 29.99,
|
|
78
|
-
currency: 'USD',
|
|
79
|
-
category: 'digital',
|
|
80
|
-
plan: 'premium'
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
// User action with context
|
|
84
|
-
journium.track('video_played', {
|
|
85
|
-
video_id: 'intro-2024',
|
|
86
|
-
video_length: 120,
|
|
87
|
-
quality: '1080p',
|
|
88
|
-
autoplay: false
|
|
45
|
+
journium.track('button_clicked', {
|
|
46
|
+
button_name: 'signup',
|
|
47
|
+
page: 'homepage',
|
|
48
|
+
user_type: 'visitor'
|
|
89
49
|
});
|
|
90
50
|
```
|
|
91
51
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Identify a user when they log in or sign up. This method should be used instead of tracking user login as a custom event.
|
|
52
|
+
### Identify a User
|
|
53
|
+
Identify users when they log in or sign up to connect their actions across sessions.
|
|
95
54
|
|
|
96
55
|
```javascript
|
|
97
|
-
// When user logs in or signs up
|
|
98
56
|
journium.identify('user_12345', {
|
|
99
57
|
name: 'John Doe',
|
|
100
|
-
email: 'john@example.com'
|
|
58
|
+
email: 'john@example.com',
|
|
59
|
+
plan: 'premium'
|
|
101
60
|
});
|
|
102
|
-
|
|
103
|
-
// Minimal identification (just user ID)
|
|
104
|
-
journium.identify('user_67890');
|
|
105
61
|
```
|
|
106
62
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Reset user identity when they log out. This generates a new anonymous distinct ID and should be called on user logout.
|
|
63
|
+
### Reset User Identity
|
|
64
|
+
Reset user identity when they log out to ensure privacy and accurate tracking.
|
|
110
65
|
|
|
111
66
|
```javascript
|
|
112
|
-
// When user logs out
|
|
113
67
|
journium.reset();
|
|
114
68
|
```
|
|
115
69
|
|
|
116
|
-
|
|
70
|
+
## Advanced Setup
|
|
117
71
|
|
|
118
|
-
|
|
72
|
+
You can override default configurations:
|
|
119
73
|
|
|
120
74
|
```javascript
|
|
121
|
-
|
|
122
|
-
journium.capturePageview();
|
|
123
|
-
|
|
124
|
-
// Pageview with custom properties
|
|
125
|
-
journium.capturePageview({
|
|
126
|
-
section: 'pricing',
|
|
127
|
-
experiment_variant: 'v2',
|
|
128
|
-
user_plan: 'free'
|
|
129
|
-
});
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### Auto-Capture
|
|
133
|
-
|
|
134
|
-
#### `journium.startAutoCapture()` / `journium.stopAutoCapture()`
|
|
135
|
-
|
|
136
|
-
Control automatic event capture for clicks, pageviews, and form interactions.
|
|
137
|
-
|
|
138
|
-
**Note:** Autocapture is enabled by default. You can disable it entirely with `autocapture: false` in your config, or control it programmatically:
|
|
139
|
-
|
|
140
|
-
```javascript
|
|
141
|
-
// Start capturing events automatically (autocapture is enabled by default)
|
|
142
|
-
journium.startAutoCapture();
|
|
143
|
-
|
|
144
|
-
// Stop automatic capture
|
|
145
|
-
journium.stopAutoCapture();
|
|
146
|
-
|
|
147
|
-
// Or disable entirely in configuration:
|
|
148
|
-
const journium = init({
|
|
149
|
-
token: 'your-token',
|
|
150
|
-
apiHost: 'your-api.com',
|
|
151
|
-
autocapture: false // Disables all autocapture functionality
|
|
152
|
-
});
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
Configure what gets auto-captured:
|
|
75
|
+
import { init } from '@journium/js';
|
|
156
76
|
|
|
157
|
-
```javascript
|
|
158
77
|
const journium = init({
|
|
159
|
-
|
|
160
|
-
apiHost: 'https://your-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
78
|
+
publishableKey: 'your-journium-publishable-key',
|
|
79
|
+
apiHost: 'https://your-custom-instance.com', // Optional: defaults to 'https://events.journium.app'
|
|
80
|
+
options: {
|
|
81
|
+
debug: true, // Enable debug logging
|
|
82
|
+
flushAt: 10, // Send events after N events
|
|
83
|
+
flushInterval: 5000, // Send events every N milliseconds
|
|
84
|
+
sessionTimeout: 1800000, // Session timeout (30 minutes)
|
|
85
|
+
autoTrackPageviews: true, // Track pageview events (default: true)
|
|
86
|
+
autocapture: { // Configure automatic event capture
|
|
87
|
+
captureClicks: true, // Track click events
|
|
88
|
+
captureFormSubmits: true, // Track form submissions
|
|
89
|
+
captureFormChanges: false, // Track form field changes
|
|
90
|
+
ignoreClasses: ['no-track'], // CSS classes to ignore
|
|
91
|
+
ignoreElements: ['input[type="password"]'] // Elements to ignore
|
|
92
|
+
}
|
|
169
93
|
}
|
|
170
94
|
});
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Data Management
|
|
174
95
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
Manually send queued events to the server.
|
|
178
|
-
|
|
179
|
-
```javascript
|
|
180
|
-
// Send all pending events immediately
|
|
181
|
-
await journium.flush();
|
|
96
|
+
// Start automatic event capture
|
|
97
|
+
journium.startAutocapture();
|
|
182
98
|
```
|
|
183
99
|
|
|
184
|
-
|
|
100
|
+
## API Reference
|
|
185
101
|
|
|
186
|
-
|
|
102
|
+
### Functions
|
|
187
103
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
journium.destroy();
|
|
191
|
-
```
|
|
104
|
+
#### `init(config: JourniumConfig)`
|
|
105
|
+
Initializes and returns a new JourniumAnalytics instance.
|
|
192
106
|
|
|
193
|
-
|
|
107
|
+
**Parameters:**
|
|
108
|
+
- `config: JourniumConfig` - Configuration object for Journium
|
|
109
|
+
- `publishableKey: string` - Your Journium publishable key (required)
|
|
110
|
+
- `apiHost?: string` - Custom API endpoint (optional, defaults to 'https://events.journium.app')
|
|
111
|
+
- `options?: JourniumLocalOptions` - Local configuration options (optional)
|
|
194
112
|
|
|
195
|
-
|
|
113
|
+
**Returns:** `JourniumAnalytics` - Analytics instance for tracking events
|
|
196
114
|
|
|
197
|
-
|
|
115
|
+
### JourniumAnalytics Instance Methods
|
|
198
116
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
- `distinct_id` - User identifier (anonymous until `identify()` is called)
|
|
202
|
-
- `$is_identified` - Whether the user has been identified (true/false)
|
|
203
|
-
- `$current_url` - Current page URL
|
|
204
|
-
- `$pathname` - URL pathname
|
|
205
|
-
- `$browser` - Browser name (Chrome, Firefox, etc.)
|
|
206
|
-
- `$os` - Operating system (Windows, macOS, etc.)
|
|
207
|
-
- `$device_type` - Device type (desktop, mobile, tablet)
|
|
208
|
-
- `$lib_version` - SDK version
|
|
209
|
-
- `$platform` - Always "web"
|
|
117
|
+
#### `track(event: string, properties?: Record<string, unknown>): void`
|
|
118
|
+
Tracks custom events with optional properties.
|
|
210
119
|
|
|
211
|
-
|
|
120
|
+
**Parameters:**
|
|
121
|
+
- `event: string` - Event name to track
|
|
122
|
+
- `properties?: Record<string, unknown>` - Optional event properties
|
|
212
123
|
|
|
213
|
-
|
|
124
|
+
#### `identify(distinctId: string, attributes?: Record<string, unknown>): void`
|
|
125
|
+
Identifies a user and associates future events with their identity.
|
|
214
126
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
feature_name: 'dark_mode',
|
|
219
|
-
user_plan: 'premium',
|
|
220
|
-
user_role: 'admin',
|
|
221
|
-
experiment_group: 'control',
|
|
222
|
-
|
|
223
|
-
// Nested objects work too
|
|
224
|
-
user_preferences: {
|
|
225
|
-
theme: 'dark',
|
|
226
|
-
language: 'en',
|
|
227
|
-
timezone: 'UTC'
|
|
228
|
-
}
|
|
229
|
-
});
|
|
230
|
-
```
|
|
127
|
+
**Parameters:**
|
|
128
|
+
- `distinctId: string` - Unique user identifier
|
|
129
|
+
- `attributes?: Record<string, unknown>` - Optional user attributes
|
|
231
130
|
|
|
232
|
-
|
|
131
|
+
#### `reset(): void`
|
|
132
|
+
Resets user identity, typically called on logout.
|
|
233
133
|
|
|
234
|
-
|
|
134
|
+
**Returns:** `void`
|
|
235
135
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
token: 'your-journium-token', // Your project token from Journium
|
|
239
|
-
apiHost: 'https://api.journium.com' // Your Journium API endpoint
|
|
240
|
-
}
|
|
241
|
-
```
|
|
136
|
+
#### `capturePageview(properties?: Record<string, unknown>): void`
|
|
137
|
+
Manually captures pageview events.
|
|
242
138
|
|
|
243
|
-
|
|
139
|
+
**Parameters:**
|
|
140
|
+
- `properties?: Record<string, unknown>` - Optional pageview properties
|
|
244
141
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
debug: false, // Enable console logging
|
|
248
|
-
flushAt: 20, // Send events after N events queued
|
|
249
|
-
flushInterval: 10000, // Send events every N milliseconds
|
|
250
|
-
sessionTimeout: 1800000, // Session timeout (30 minutes)
|
|
251
|
-
autocapture: true // Default: true - set false to disable auto-capture
|
|
252
|
-
}
|
|
253
|
-
```
|
|
142
|
+
#### `startAutocapture(): void`
|
|
143
|
+
Starts automatic event capture for clicks, form interactions, and pageviews.
|
|
254
144
|
|
|
255
|
-
|
|
145
|
+
**Returns:** `void`
|
|
256
146
|
|
|
257
|
-
|
|
258
|
-
{
|
|
259
|
-
autocapture: {
|
|
260
|
-
captureClicks: true, // Capture click events
|
|
261
|
-
captureFormSubmits: true, // Capture form submissions
|
|
262
|
-
captureFormChanges: false, // Capture form field changes
|
|
263
|
-
captureTextSelection: false, // Capture text selection events
|
|
264
|
-
captureContentText: true, // Include element text content
|
|
265
|
-
ignoreClasses: [ // CSS classes to ignore
|
|
266
|
-
'no-track',
|
|
267
|
-
'sensitive-data',
|
|
268
|
-
'admin-only'
|
|
269
|
-
],
|
|
270
|
-
ignoreElements: [ // CSS selectors to ignore
|
|
271
|
-
'input[type="password"]',
|
|
272
|
-
'.credit-card-input',
|
|
273
|
-
'[data-private]'
|
|
274
|
-
]
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
```
|
|
147
|
+
**Note:** Autocapture behavior is configured during initialization via the `autocapture` option.
|
|
278
148
|
|
|
279
|
-
|
|
149
|
+
#### `stopAutocapture(): void`
|
|
150
|
+
Stops automatic event capture.
|
|
280
151
|
|
|
281
|
-
|
|
152
|
+
**Returns:** `void`
|
|
282
153
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
- **Secure transmission** - All data sent over HTTPS
|
|
286
|
-
- **Session-based** - Automatic session management without persistent user tracking
|
|
154
|
+
#### `flush(): Promise<void>`
|
|
155
|
+
Manually sends all queued events to the server immediately.
|
|
287
156
|
|
|
288
|
-
|
|
157
|
+
**Returns:** `Promise<void>` - Promise that resolves when events are sent
|
|
289
158
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
<button class="signup-btn no-track">Sign Up</button>
|
|
159
|
+
#### `destroy(): void`
|
|
160
|
+
Cleans up the SDK, stops all tracking, and sends remaining events.
|
|
293
161
|
|
|
294
|
-
|
|
295
|
-
const journium = init({
|
|
296
|
-
token: 'your-token',
|
|
297
|
-
apiHost: 'your-api.com',
|
|
298
|
-
autocapture: {
|
|
299
|
-
ignoreClasses: ['no-track', 'sensitive'],
|
|
300
|
-
ignoreElements: ['input[type="password"]', '.credit-card']
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
```
|
|
162
|
+
**Returns:** `void`
|
|
304
163
|
|
|
305
|
-
|
|
164
|
+
#### `getEffectiveOptions(): JourniumLocalOptions`
|
|
165
|
+
Returns the effective configuration options (merged local and remote options).
|
|
306
166
|
|
|
307
|
-
-
|
|
308
|
-
- ✅ **Firefox** 55+
|
|
309
|
-
- ✅ **Safari** 12+
|
|
310
|
-
- ✅ **Edge** 79+
|
|
311
|
-
- ✅ **Mobile browsers** (iOS Safari, Chrome Mobile)
|
|
167
|
+
**Returns:** `JourniumLocalOptions` - Current effective configuration
|
|
312
168
|
|
|
313
|
-
|
|
169
|
+
### Types
|
|
314
170
|
|
|
315
|
-
|
|
171
|
+
#### `JourniumConfig`
|
|
172
|
+
Configuration object for initializing Journium.
|
|
316
173
|
|
|
317
174
|
```typescript
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
debug: true
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
const journium: Journium = init(config);
|
|
327
|
-
|
|
328
|
-
// Type-safe event tracking
|
|
329
|
-
journium.track('user_action', {
|
|
330
|
-
action_type: 'click',
|
|
331
|
-
element_id: 'signup-button',
|
|
332
|
-
timestamp: new Date().toISOString()
|
|
333
|
-
});
|
|
175
|
+
interface JourniumConfig {
|
|
176
|
+
publishableKey: string;
|
|
177
|
+
apiHost?: string;
|
|
178
|
+
options?: JourniumLocalOptions;
|
|
179
|
+
}
|
|
334
180
|
```
|
|
335
181
|
|
|
336
|
-
|
|
182
|
+
#### `JourniumLocalOptions`
|
|
183
|
+
Local configuration options that can be set on the client.
|
|
337
184
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
185
|
+
```typescript
|
|
186
|
+
interface JourniumLocalOptions {
|
|
187
|
+
debug?: boolean; // Enable debug logging
|
|
188
|
+
flushAt?: number; // Number of events before auto-flush
|
|
189
|
+
flushInterval?: number; // Flush interval in milliseconds
|
|
190
|
+
autocapture?: boolean | AutocaptureOptions; // Auto-capture configuration
|
|
191
|
+
autoTrackPageviews?: boolean; // Automatic pageview tracking
|
|
192
|
+
sessionTimeout?: number; // Session timeout in milliseconds
|
|
193
|
+
sampling?: {
|
|
194
|
+
enabled?: boolean;
|
|
195
|
+
rate?: number;
|
|
196
|
+
};
|
|
197
|
+
features?: {
|
|
198
|
+
enableGeolocation?: boolean;
|
|
199
|
+
enableSessionRecording?: boolean;
|
|
200
|
+
enablePerformanceTracking?: boolean;
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
```
|
|
344
204
|
|
|
345
|
-
|
|
205
|
+
#### `AutocaptureOptions`
|
|
206
|
+
Configuration for automatic event capture.
|
|
346
207
|
|
|
347
|
-
|
|
208
|
+
```typescript
|
|
209
|
+
interface AutocaptureOptions {
|
|
210
|
+
captureClicks?: boolean; // Capture click events
|
|
211
|
+
captureFormSubmits?: boolean; // Capture form submissions
|
|
212
|
+
captureFormChanges?: boolean; // Capture form field changes
|
|
213
|
+
captureTextSelection?: boolean; // Capture text selection events
|
|
214
|
+
ignoreClasses?: string[]; // CSS classes to ignore
|
|
215
|
+
ignoreElements?: string[]; // HTML elements to ignore
|
|
216
|
+
captureContentText?: boolean; // Capture element text content
|
|
217
|
+
}
|
|
218
|
+
```
|
|
348
219
|
|
|
349
|
-
|
|
350
|
-
- **[Getting Started](https://docs.journium.app/getting-started)** - Quick setup guide
|
|
351
|
-
- **[Examples](https://docs.journium.app/examples)** - Code examples and patterns
|
|
220
|
+
### Browser Support
|
|
352
221
|
|
|
353
|
-
|
|
222
|
+
- ✅ Modern browsers (ES2017+)
|
|
223
|
+
- ✅ Chrome 60+
|
|
224
|
+
- ✅ Firefox 55+
|
|
225
|
+
- ✅ Safari 11+
|
|
226
|
+
- ✅ Edge 79+
|
|
354
227
|
|
|
355
|
-
|
|
228
|
+
### Bundle Formats
|
|
356
229
|
|
|
357
|
-
|
|
230
|
+
The package includes multiple build formats:
|
|
358
231
|
|
|
359
|
-
|
|
232
|
+
- **ESM**: `dist/index.esm.js` - For modern bundlers (webpack, Vite, Rollup)
|
|
233
|
+
- **CommonJS**: `dist/index.cjs` - For Node.js environments
|
|
234
|
+
- **UMD**: `dist/index.umd.js` - For browser `<script>` tags
|
|
360
235
|
|
|
361
|
-
|
|
236
|
+
#### UMD Usage
|
|
362
237
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
238
|
+
```html
|
|
239
|
+
<script src="node_modules/@journium/js/dist/index.umd.js"></script>
|
|
240
|
+
<script>
|
|
241
|
+
const analytics = window.JourniumAnalytics.init({
|
|
242
|
+
publishableKey: 'your-publishable-key'
|
|
243
|
+
});
|
|
244
|
+
analytics.track('page_loaded');
|
|
245
|
+
</script>
|
|
246
|
+
```
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { JourniumConfig } from '@journium/core';
|
|
2
|
+
export declare class JourniumAnalytics {
|
|
3
|
+
private client;
|
|
4
|
+
private pageviewTracker;
|
|
5
|
+
private autocaptureTracker;
|
|
6
|
+
private config;
|
|
7
|
+
private autocaptureEnabled;
|
|
8
|
+
constructor(config: JourniumConfig);
|
|
9
|
+
private resolveAutocaptureOptions;
|
|
10
|
+
track(event: string, properties?: Record<string, unknown>): void;
|
|
11
|
+
identify(distinctId: string, attributes?: Record<string, unknown>): void;
|
|
12
|
+
reset(): void;
|
|
13
|
+
capturePageview(properties?: Record<string, unknown>): void;
|
|
14
|
+
startAutocapture(): void;
|
|
15
|
+
stopAutocapture(): void;
|
|
16
|
+
flush(): Promise<void>;
|
|
17
|
+
getEffectiveOptions(): import("@journium/core").JourniumLocalOptions;
|
|
18
|
+
destroy(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare const init: (config: JourniumConfig) => JourniumAnalytics;
|
|
21
|
+
declare const _default: {
|
|
22
|
+
init: (config: JourniumConfig) => JourniumAnalytics;
|
|
23
|
+
JourniumAnalytics: typeof JourniumAnalytics;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
26
|
+
//# sourceMappingURL=JourniumAnalytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JourniumAnalytics.d.ts","sourceRoot":"","sources":["../src/JourniumAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAsB,MAAM,gBAAgB,CAAC;AAKpE,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,kBAAkB,CAAU;gBAExB,MAAM,EAAE,cAAc;IAYlC,OAAO,CAAC,yBAAyB;IAiBjC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIhE,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAIxE,KAAK,IAAI,IAAI;IAIb,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAI3D,gBAAgB,IAAI,IAAI;IAcxB,eAAe,IAAI,IAAI;IAMjB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B,mBAAmB;IAInB,OAAO,IAAI,IAAI;CAKhB;AAED,eAAO,MAAM,IAAI,GAAI,QAAQ,cAAc,KAAG,iBAE7C,CAAC;;mBAF2B,cAAc,KAAG,iBAAiB;;;AAI/D,wBAA2C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { JourniumConfig, JourniumLocalOptions } from '@journium/core';
|
|
2
|
+
export declare class JourniumClient {
|
|
3
|
+
private config;
|
|
4
|
+
private effectiveOptions;
|
|
5
|
+
private queue;
|
|
6
|
+
private flushTimer;
|
|
7
|
+
private initialized;
|
|
8
|
+
private identityManager;
|
|
9
|
+
private optionsStorageKey;
|
|
10
|
+
constructor(config: JourniumConfig);
|
|
11
|
+
private loadCachedOptions;
|
|
12
|
+
private saveCachedOptions;
|
|
13
|
+
private initializeSync;
|
|
14
|
+
private fetchRemoteOptionsAsync;
|
|
15
|
+
private fetchAndCacheRemoteOptions;
|
|
16
|
+
private startFlushTimer;
|
|
17
|
+
private sendEvents;
|
|
18
|
+
identify(distinctId: string, attributes?: Record<string, unknown>): void;
|
|
19
|
+
reset(): void;
|
|
20
|
+
track(event: string, properties?: Record<string, unknown>): void;
|
|
21
|
+
flush(): Promise<void>;
|
|
22
|
+
destroy(): void;
|
|
23
|
+
getEffectiveOptions(): JourniumLocalOptions;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=JourniumClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JourniumClient.d.ts","sourceRoot":"","sources":["../src/JourniumClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,oBAAoB,EAAwH,MAAM,gBAAgB,CAAC;AAE3M,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,gBAAgB,CAAwB;IAChD,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,UAAU,CAA+C;IACjE,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,eAAe,CAA0B;IACjD,OAAO,CAAC,iBAAiB,CAAU;gBAEvB,MAAM,EAAE,cAAc;IAsClC,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,cAAc;YA0BR,uBAAuB;YAOvB,0BAA0B;IAyCxC,OAAO,CAAC,eAAe;YAWT,UAAU;IA8BxB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAyB5E,KAAK,IAAI,IAAI;IAiBb,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IA4C9D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB5B,OAAO,IAAI,IAAI;IAQf,mBAAmB,IAAI,oBAAoB;CAG5C"}
|
package/dist/autocapture.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
import { JourniumClient } from './
|
|
2
|
-
|
|
3
|
-
captureClicks?: boolean;
|
|
4
|
-
captureFormSubmits?: boolean;
|
|
5
|
-
captureFormChanges?: boolean;
|
|
6
|
-
captureTextSelection?: boolean;
|
|
7
|
-
ignoreClasses?: string[];
|
|
8
|
-
ignoreElements?: string[];
|
|
9
|
-
captureContentText?: boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface AutocaptureEvent {
|
|
12
|
-
event: string;
|
|
13
|
-
properties: Record<string, any>;
|
|
14
|
-
}
|
|
1
|
+
import { JourniumClient } from './JourniumClient';
|
|
2
|
+
import { AutocaptureOptions } from '@journium/core';
|
|
15
3
|
export declare class AutocaptureTracker {
|
|
16
4
|
private client;
|
|
17
|
-
private
|
|
5
|
+
private options;
|
|
18
6
|
private listeners;
|
|
19
7
|
private isActive;
|
|
20
|
-
constructor(client: JourniumClient,
|
|
8
|
+
constructor(client: JourniumClient, options?: AutocaptureOptions);
|
|
21
9
|
start(): void;
|
|
22
10
|
stop(): void;
|
|
23
11
|
private addClickListener;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocapture.d.ts","sourceRoot":"","sources":["../src/autocapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"autocapture.d.ts","sourceRoot":"","sources":["../src/autocapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAa,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/D,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,QAAQ,CAAkB;gBAEtB,MAAM,EAAE,cAAc,EAAE,OAAO,GAAE,kBAAuB;IAcpE,KAAK,IAAI,IAAI;IAwBb,IAAI,IAAI,IAAI;IAcZ,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,wBAAwB;IAuBhC,OAAO,CAAC,mBAAmB;IA2B3B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,oBAAoB;IAiE5B,OAAO,CAAC,iBAAiB;IAsBzB,OAAO,CAAC,kBAAkB;IAuC1B,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,gBAAgB;IAqFxB,OAAO,CAAC,eAAe;CAKxB"}
|
package/dist/client.d.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import { JourniumConfig } from '@journium/core';
|
|
1
|
+
import { JourniumConfig, JourniumLocalOptions } from '@journium/core';
|
|
2
2
|
export declare class JourniumClient {
|
|
3
3
|
private config;
|
|
4
|
+
private effectiveOptions;
|
|
4
5
|
private queue;
|
|
5
6
|
private flushTimer;
|
|
6
7
|
private initialized;
|
|
7
8
|
private identityManager;
|
|
8
|
-
private
|
|
9
|
+
private optionsStorageKey;
|
|
9
10
|
constructor(config: JourniumConfig);
|
|
10
|
-
private
|
|
11
|
-
private
|
|
11
|
+
private loadCachedOptions;
|
|
12
|
+
private saveCachedOptions;
|
|
12
13
|
private initializeSync;
|
|
13
|
-
private
|
|
14
|
-
private
|
|
14
|
+
private fetchRemoteOptionsAsync;
|
|
15
|
+
private fetchAndCacheRemoteOptions;
|
|
15
16
|
private startFlushTimer;
|
|
16
17
|
private sendEvents;
|
|
17
|
-
identify(distinctId: string, attributes?: Record<string,
|
|
18
|
+
identify(distinctId: string, attributes?: Record<string, unknown>): void;
|
|
18
19
|
reset(): void;
|
|
19
|
-
track(event: string, properties?: Record<string,
|
|
20
|
+
track(event: string, properties?: Record<string, unknown>): void;
|
|
20
21
|
flush(): Promise<void>;
|
|
21
22
|
destroy(): void;
|
|
23
|
+
getEffectiveOptions(): JourniumLocalOptions;
|
|
22
24
|
}
|
|
23
25
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,cAAc,EAAE,oBAAoB,EAAwH,MAAM,gBAAgB,CAAC;AAE3M,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,gBAAgB,CAAwB;IAChD,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,UAAU,CAA+C;IACjE,OAAO,CAAC,WAAW,CAAkB;IACrC,OAAO,CAAC,eAAe,CAA0B;IACjD,OAAO,CAAC,iBAAiB,CAAU;gBAEvB,MAAM,EAAE,cAAc;IAsClC,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,iBAAiB;IAczB,OAAO,CAAC,cAAc;YA0BR,uBAAuB;YAOvB,0BAA0B;IAyCxC,OAAO,CAAC,eAAe;YAWT,UAAU;IA8BxB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IAyB5E,KAAK,IAAI,IAAI;IAiBb,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,IAAI;IA4C9D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB5B,OAAO,IAAI,IAAI;IAQf,mBAAmB,IAAI,oBAAoB;CAG5C"}
|