wisetrack 2.0.9 → 2.1.1
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 +75 -24
- package/dist/cdn/sdk.bundle.min.js +1 -1
- package/dist/cjs/constants/constants.d.ts +3 -1
- package/dist/cjs/constants/endpoints.d.ts +9 -6
- package/dist/cjs/constants/environments.d.ts +1 -1
- package/dist/cjs/core/caching/queue-data.d.ts +0 -1
- package/dist/cjs/core/caching/request-queue-manager.d.ts +16 -31
- package/dist/cjs/core/fields/click-match-fields-builder.d.ts +7 -0
- package/dist/cjs/core/fields/heartbeat-fields-builder.d.ts +7 -0
- package/dist/cjs/core/network/api-client.d.ts +16 -4
- package/dist/cjs/core/network/network-error.d.ts +32 -16
- package/dist/cjs/core/network/network-manager.d.ts +9 -4
- package/dist/cjs/core/storage/storage-manager.d.ts +23 -2
- package/dist/cjs/core/wisetrack.d.ts +31 -9
- package/dist/cjs/core/wt-configure.d.ts +18 -0
- package/dist/cjs/core/wt-tracker.d.ts +5 -2
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types/config/initial-config.d.ts +8 -0
- package/dist/cjs/types/config/secure-config.d.ts +11 -0
- package/dist/cjs/types/config/wt-auth.d.ts +7 -0
- package/dist/cjs/types/config/wt-config-endpoints.d.ts +15 -0
- package/dist/cjs/types/config/wt-config.d.ts +4 -6
- package/dist/cjs/types/wt-deferred-lookup.d.ts +6 -0
- package/dist/cjs/utils/country-finder.d.ts +1 -0
- package/dist/cjs/utils/crypto-helper.d.ts +1 -1
- package/dist/cjs/utils/heartbeat-manager.d.ts +0 -0
- package/dist/cjs/utils/lifecycle-observer.d.ts +32 -0
- package/dist/cjs/utils/utils.d.ts +1 -0
- package/dist/cjs/utils/webgl-fingerprint.d.ts +3 -3
- package/dist/esm/constants/constants.d.ts +3 -1
- package/dist/esm/constants/endpoints.d.ts +9 -6
- package/dist/esm/constants/environments.d.ts +1 -1
- package/dist/esm/core/caching/queue-data.d.ts +0 -1
- package/dist/esm/core/caching/request-queue-manager.d.ts +16 -31
- package/dist/esm/core/fields/click-match-fields-builder.d.ts +7 -0
- package/dist/esm/core/fields/heartbeat-fields-builder.d.ts +7 -0
- package/dist/esm/core/network/api-client.d.ts +16 -4
- package/dist/esm/core/network/network-error.d.ts +32 -16
- package/dist/esm/core/network/network-manager.d.ts +9 -4
- package/dist/esm/core/storage/storage-manager.d.ts +23 -2
- package/dist/esm/core/wisetrack.d.ts +31 -9
- package/dist/esm/core/wt-configure.d.ts +18 -0
- package/dist/esm/core/wt-tracker.d.ts +5 -2
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/types/config/initial-config.d.ts +8 -0
- package/dist/esm/types/config/secure-config.d.ts +11 -0
- package/dist/esm/types/config/wt-auth.d.ts +7 -0
- package/dist/esm/types/config/wt-config-endpoints.d.ts +15 -0
- package/dist/esm/types/config/wt-config.d.ts +4 -6
- package/dist/esm/types/wt-deferred-lookup.d.ts +6 -0
- package/dist/esm/utils/country-finder.d.ts +1 -0
- package/dist/esm/utils/crypto-helper.d.ts +1 -1
- package/dist/esm/utils/heartbeat-manager.d.ts +0 -0
- package/dist/esm/utils/lifecycle-observer.d.ts +32 -0
- package/dist/esm/utils/utils.d.ts +1 -0
- package/dist/esm/utils/webgl-fingerprint.d.ts +3 -3
- package/package.json +15 -13
- package/dist/cjs/utils/activity-ticker.d.ts +0 -12
- package/dist/esm/utils/activity-ticker.d.ts +0 -12
package/README.md
CHANGED
|
@@ -15,10 +15,9 @@ A lightweight JavaScript SDK for tracking user behavior and events in your web a
|
|
|
15
15
|
- Supports custom and revenue events
|
|
16
16
|
- Environment-based configuration (Sandbox & Production)
|
|
17
17
|
- Automatic or manual tracking control
|
|
18
|
+
- Deep link tracking and handling with deferred deep link support
|
|
18
19
|
- Customizable logging level
|
|
19
20
|
- TypeScript support with full type definitions
|
|
20
|
-
- Tree-shakable ESM and CommonJS builds
|
|
21
|
-
- Zero dependencies (except ua-parser-js)
|
|
22
21
|
|
|
23
22
|
---
|
|
24
23
|
|
|
@@ -62,6 +61,7 @@ import { WiseTrack, WTUserEnvironment, WTLogLevel } from "wisetrack";
|
|
|
62
61
|
|
|
63
62
|
await WiseTrack.instance.init({
|
|
64
63
|
appToken: "YOUR_APP_TOKEN",
|
|
64
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
65
65
|
appVersion: "1.0.0",
|
|
66
66
|
appFrameWork: "Next.js",
|
|
67
67
|
userEnvironment: WTUserEnvironment.SANDBOX,
|
|
@@ -116,6 +116,7 @@ await WiseTrack.instance.trackEvent(purchase);
|
|
|
116
116
|
// Initialize
|
|
117
117
|
WiseTrackSDK.WiseTrack.instance.init({
|
|
118
118
|
appToken: "YOUR_APP_TOKEN",
|
|
119
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
119
120
|
appVersion: "1.0.0",
|
|
120
121
|
appFrameWork: "Vanilla JS",
|
|
121
122
|
userEnvironment: WiseTrackSDK.WTUserEnvironment.SANDBOX,
|
|
@@ -174,6 +175,7 @@ workbox.routing.registerRoute(
|
|
|
174
175
|
| Key | Required | Default | Description |
|
|
175
176
|
| --------------------------- | -------- | ------------ | -------------------------------------------------------------- |
|
|
176
177
|
| `appToken` | ✅ | - | Your unique WiseTrack app token |
|
|
178
|
+
| `clientSecret` | ✅ | - | Your client secret provided by WiseTrack Panel |
|
|
177
179
|
| `appVersion` | ✅ | - | Your app version |
|
|
178
180
|
| `appFrameWork` | ✅ | - | The framework/platform name |
|
|
179
181
|
| `userEnvironment` | ❌ | `PRODUCTION` | `WTUserEnvironment.SANDBOX` or `WTUserEnvironment.PRODUCTION` |
|
|
@@ -182,6 +184,7 @@ workbox.routing.registerRoute(
|
|
|
182
184
|
| `customDeviceId` | ❌ | `auto` | Provide your own device ID |
|
|
183
185
|
| `defaultTracker` | ❌ | - | Optional tracker name |
|
|
184
186
|
| `logLevel` | ❌ | `INFO` | Logging level (`WTLogLevel.DEBUG` / `INFO` / `WARN` / `ERROR`) |
|
|
187
|
+
| `deeplinkEnabled` | ❌ | `true` | Whether to enable deep link tracking and handling |
|
|
185
188
|
|
|
186
189
|
---
|
|
187
190
|
|
|
@@ -194,6 +197,70 @@ WiseTrack.instance.flush();
|
|
|
194
197
|
|
|
195
198
|
---
|
|
196
199
|
|
|
200
|
+
## 🔗 Deep Link Handling
|
|
201
|
+
|
|
202
|
+
WiseTrack SDK provides comprehensive deep link tracking and handling capabilities for attribution and user engagement.
|
|
203
|
+
|
|
204
|
+
### Listening to Deep Links
|
|
205
|
+
|
|
206
|
+
Set a callback listener to receive deep link events:
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
import { DeeplinkHandler } from "wisetrack";
|
|
210
|
+
|
|
211
|
+
WiseTrack.instance.setOnDeeplinkListener((uri: string, isDeferred: boolean) => {
|
|
212
|
+
console.log("Deep link received:", uri);
|
|
213
|
+
console.log("Is deferred:", isDeferred);
|
|
214
|
+
|
|
215
|
+
// Handle the deep link (e.g., navigate to the URL)
|
|
216
|
+
if (isDeferred) {
|
|
217
|
+
// This is a deferred deep link (for attribution after app install)
|
|
218
|
+
// window.location.href = uri;
|
|
219
|
+
// navigate(deepLink.path);
|
|
220
|
+
// router.push(deepLink.path);
|
|
221
|
+
// or any navigation method here ...
|
|
222
|
+
|
|
223
|
+
} else {
|
|
224
|
+
// Regular deep link
|
|
225
|
+
// Handle navigation or other actions
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Getting Deep Links
|
|
231
|
+
|
|
232
|
+
Retrieve the last recorded deep link or deferred deep link:
|
|
233
|
+
|
|
234
|
+
```typescript
|
|
235
|
+
// Get the last recorded deep link
|
|
236
|
+
const lastDeeplink = WiseTrack.instance.getLastDeeplink();
|
|
237
|
+
if (lastDeeplink) {
|
|
238
|
+
console.log("Last deeplink:", lastDeeplink);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Get the deferred deep link (for attribution)
|
|
242
|
+
const deferredDeeplink = WiseTrack.instance.getDeferredDeeplink();
|
|
243
|
+
if (deferredDeeplink) {
|
|
244
|
+
console.log("Deferred deeplink:", deferredDeeplink);
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Disabling Deep Link Tracking
|
|
249
|
+
|
|
250
|
+
If you want to disable deep link tracking, set `deeplinkEnabled` to `false` in your initial configuration:
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
await WiseTrack.instance.init({
|
|
254
|
+
appToken: "YOUR_APP_TOKEN",
|
|
255
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
256
|
+
appVersion: "1.0.0",
|
|
257
|
+
appFrameWork: "Next.js",
|
|
258
|
+
deeplinkEnabled: false, // Disable deep link tracking
|
|
259
|
+
});
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
197
264
|
## 🔍 Log Level
|
|
198
265
|
|
|
199
266
|
Set the SDK log level for debugging:
|
|
@@ -216,6 +283,7 @@ export default function App() {
|
|
|
216
283
|
useEffect(() => {
|
|
217
284
|
WiseTrack.instance.init({
|
|
218
285
|
appToken: "YOUR_APP_TOKEN",
|
|
286
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
219
287
|
appVersion: "1.0.0",
|
|
220
288
|
appFrameWork: "React",
|
|
221
289
|
userEnvironment: WTUserEnvironment.PRODUCTION,
|
|
@@ -236,6 +304,7 @@ import { WiseTrack, WTUserEnvironment } from "wisetrack";
|
|
|
236
304
|
onMounted(() => {
|
|
237
305
|
WiseTrack.instance.init({
|
|
238
306
|
appToken: "YOUR_APP_TOKEN",
|
|
307
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
239
308
|
appVersion: "1.0.0",
|
|
240
309
|
appFrameWork: "Vue.js",
|
|
241
310
|
userEnvironment: WTUserEnvironment.PRODUCTION,
|
|
@@ -258,6 +327,7 @@ export class AppComponent implements OnInit {
|
|
|
258
327
|
async ngOnInit() {
|
|
259
328
|
await WiseTrack.instance.init({
|
|
260
329
|
appToken: "YOUR_APP_TOKEN",
|
|
330
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
261
331
|
appVersion: "1.0.0",
|
|
262
332
|
appFrameWork: "Angular",
|
|
263
333
|
userEnvironment: WTUserEnvironment.PRODUCTION,
|
|
@@ -266,15 +336,6 @@ export class AppComponent implements OnInit {
|
|
|
266
336
|
}
|
|
267
337
|
```
|
|
268
338
|
|
|
269
|
-
---
|
|
270
|
-
|
|
271
|
-
## 📊 Bundle Size & Performance
|
|
272
|
-
|
|
273
|
-
| Build Type | Size (Minified) | Size (Gzipped) | Use Case |
|
|
274
|
-
| ---------- | --------------- | -------------- | ------------------------------- |
|
|
275
|
-
| ESM | ~45KB | ~12KB | Modern bundlers (Webpack, Vite) |
|
|
276
|
-
| CommonJS | ~45KB | ~12KB | Node.js, older bundlers |
|
|
277
|
-
| CDN Bundle | ~25KB | ~8KB | Direct browser usage |
|
|
278
339
|
|
|
279
340
|
---
|
|
280
341
|
|
|
@@ -283,10 +344,11 @@ export class AppComponent implements OnInit {
|
|
|
283
344
|
This package includes TypeScript definitions out of the box. No need to install additional `@types` packages.
|
|
284
345
|
|
|
285
346
|
```typescript
|
|
286
|
-
import type {
|
|
347
|
+
import type { WTInitialConfig, WTEventData } from "wisetrack";
|
|
287
348
|
|
|
288
|
-
const config:
|
|
349
|
+
const config: WTInitialConfig = {
|
|
289
350
|
appToken: "YOUR_APP_TOKEN",
|
|
351
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
290
352
|
appVersion: "1.0.0",
|
|
291
353
|
appFrameWork: "TypeScript App",
|
|
292
354
|
};
|
|
@@ -294,17 +356,6 @@ const config: WTConfig = {
|
|
|
294
356
|
|
|
295
357
|
---
|
|
296
358
|
|
|
297
|
-
## 🧪 Browser Compatibility
|
|
298
|
-
|
|
299
|
-
| Browser | Version |
|
|
300
|
-
| ------- | ------- |
|
|
301
|
-
| Chrome | ≥ 60 |
|
|
302
|
-
| Firefox | ≥ 60 |
|
|
303
|
-
| Safari | ≥ 12 |
|
|
304
|
-
| Edge | ≥ 79 |
|
|
305
|
-
|
|
306
|
-
---
|
|
307
|
-
|
|
308
359
|
## 📚 API Reference & Support
|
|
309
360
|
|
|
310
361
|
- [📖 Documentation](https://docs.wisetrack.io)
|