wisetrack 2.0.8 → 2.1.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.
- package/README.md +91 -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 -8
- 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 -8
- 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 +16 -14
- 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,
|
|
@@ -151,6 +152,22 @@ const { WiseTrack, WTUserEnvironment, WTLogLevel } = require("wisetrack");
|
|
|
151
152
|
// Same usage as ES6 modules
|
|
152
153
|
```
|
|
153
154
|
|
|
155
|
+
### Using in Progressive Web Apps (PWA)
|
|
156
|
+
|
|
157
|
+
WiseTrack is fully compatible with Progressive Web Apps (PWAs).
|
|
158
|
+
However, to ensure accurate tracking and data delivery, please note:
|
|
159
|
+
|
|
160
|
+
**Exclude WiseTrack API requests from Service Worker caching**
|
|
161
|
+
If you are using `workbox` or a custom `service-worker.js`,
|
|
162
|
+
add this rule to avoid caching:
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
workbox.routing.registerRoute(
|
|
166
|
+
({ url }) => url.origin.includes("wisetrack.io"),
|
|
167
|
+
new workbox.strategies.NetworkOnly()
|
|
168
|
+
);
|
|
169
|
+
```
|
|
170
|
+
|
|
154
171
|
---
|
|
155
172
|
|
|
156
173
|
## ⚙️ Configuration Options
|
|
@@ -158,6 +175,7 @@ const { WiseTrack, WTUserEnvironment, WTLogLevel } = require("wisetrack");
|
|
|
158
175
|
| Key | Required | Default | Description |
|
|
159
176
|
| --------------------------- | -------- | ------------ | -------------------------------------------------------------- |
|
|
160
177
|
| `appToken` | ✅ | - | Your unique WiseTrack app token |
|
|
178
|
+
| `clientSecret` | ✅ | - | Your client secret provided by WiseTrack Panel |
|
|
161
179
|
| `appVersion` | ✅ | - | Your app version |
|
|
162
180
|
| `appFrameWork` | ✅ | - | The framework/platform name |
|
|
163
181
|
| `userEnvironment` | ❌ | `PRODUCTION` | `WTUserEnvironment.SANDBOX` or `WTUserEnvironment.PRODUCTION` |
|
|
@@ -166,6 +184,7 @@ const { WiseTrack, WTUserEnvironment, WTLogLevel } = require("wisetrack");
|
|
|
166
184
|
| `customDeviceId` | ❌ | `auto` | Provide your own device ID |
|
|
167
185
|
| `defaultTracker` | ❌ | - | Optional tracker name |
|
|
168
186
|
| `logLevel` | ❌ | `INFO` | Logging level (`WTLogLevel.DEBUG` / `INFO` / `WARN` / `ERROR`) |
|
|
187
|
+
| `deeplinkEnabled` | ❌ | `true` | Whether to enable deep link tracking and handling |
|
|
169
188
|
|
|
170
189
|
---
|
|
171
190
|
|
|
@@ -178,6 +197,70 @@ WiseTrack.instance.flush();
|
|
|
178
197
|
|
|
179
198
|
---
|
|
180
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
|
+
|
|
181
264
|
## 🔍 Log Level
|
|
182
265
|
|
|
183
266
|
Set the SDK log level for debugging:
|
|
@@ -200,6 +283,7 @@ export default function App() {
|
|
|
200
283
|
useEffect(() => {
|
|
201
284
|
WiseTrack.instance.init({
|
|
202
285
|
appToken: "YOUR_APP_TOKEN",
|
|
286
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
203
287
|
appVersion: "1.0.0",
|
|
204
288
|
appFrameWork: "React",
|
|
205
289
|
userEnvironment: WTUserEnvironment.PRODUCTION,
|
|
@@ -220,6 +304,7 @@ import { WiseTrack, WTUserEnvironment } from "wisetrack";
|
|
|
220
304
|
onMounted(() => {
|
|
221
305
|
WiseTrack.instance.init({
|
|
222
306
|
appToken: "YOUR_APP_TOKEN",
|
|
307
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
223
308
|
appVersion: "1.0.0",
|
|
224
309
|
appFrameWork: "Vue.js",
|
|
225
310
|
userEnvironment: WTUserEnvironment.PRODUCTION,
|
|
@@ -242,6 +327,7 @@ export class AppComponent implements OnInit {
|
|
|
242
327
|
async ngOnInit() {
|
|
243
328
|
await WiseTrack.instance.init({
|
|
244
329
|
appToken: "YOUR_APP_TOKEN",
|
|
330
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
245
331
|
appVersion: "1.0.0",
|
|
246
332
|
appFrameWork: "Angular",
|
|
247
333
|
userEnvironment: WTUserEnvironment.PRODUCTION,
|
|
@@ -250,15 +336,6 @@ export class AppComponent implements OnInit {
|
|
|
250
336
|
}
|
|
251
337
|
```
|
|
252
338
|
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
## 📊 Bundle Size & Performance
|
|
256
|
-
|
|
257
|
-
| Build Type | Size (Minified) | Size (Gzipped) | Use Case |
|
|
258
|
-
| ---------- | --------------- | -------------- | ------------------------------- |
|
|
259
|
-
| ESM | ~45KB | ~12KB | Modern bundlers (Webpack, Vite) |
|
|
260
|
-
| CommonJS | ~45KB | ~12KB | Node.js, older bundlers |
|
|
261
|
-
| CDN Bundle | ~25KB | ~8KB | Direct browser usage |
|
|
262
339
|
|
|
263
340
|
---
|
|
264
341
|
|
|
@@ -267,10 +344,11 @@ export class AppComponent implements OnInit {
|
|
|
267
344
|
This package includes TypeScript definitions out of the box. No need to install additional `@types` packages.
|
|
268
345
|
|
|
269
346
|
```typescript
|
|
270
|
-
import type {
|
|
347
|
+
import type { WTInitialConfig, WTEventData } from "wisetrack";
|
|
271
348
|
|
|
272
|
-
const config:
|
|
349
|
+
const config: WTInitialConfig = {
|
|
273
350
|
appToken: "YOUR_APP_TOKEN",
|
|
351
|
+
clientSecret: "YOUR_CLIENT_SECRET",
|
|
274
352
|
appVersion: "1.0.0",
|
|
275
353
|
appFrameWork: "TypeScript App",
|
|
276
354
|
};
|
|
@@ -278,17 +356,6 @@ const config: WTConfig = {
|
|
|
278
356
|
|
|
279
357
|
---
|
|
280
358
|
|
|
281
|
-
## 🧪 Browser Compatibility
|
|
282
|
-
|
|
283
|
-
| Browser | Version |
|
|
284
|
-
| ------- | ------- |
|
|
285
|
-
| Chrome | ≥ 60 |
|
|
286
|
-
| Firefox | ≥ 60 |
|
|
287
|
-
| Safari | ≥ 12 |
|
|
288
|
-
| Edge | ≥ 79 |
|
|
289
|
-
|
|
290
|
-
---
|
|
291
|
-
|
|
292
359
|
## 📚 API Reference & Support
|
|
293
360
|
|
|
294
361
|
- [📖 Documentation](https://docs.wisetrack.io)
|