wisetrack 2.0.3 โ†’ 2.0.5

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 CHANGED
@@ -25,6 +25,7 @@ A lightweight JavaScript SDK for tracking user behavior and events in your web a
25
25
  ## ๐Ÿ“ฆ Installation
26
26
 
27
27
  ### Via npm, yarn or pnpm
28
+
28
29
  ```bash
29
30
  npm install wisetrack
30
31
  yarn add wisetrack
@@ -32,6 +33,7 @@ pnpm add wisetrack
32
33
  ```
33
34
 
34
35
  ### Via CDN (Direct Browser Usage)
36
+
35
37
  ```html
36
38
  <!-- Latest version -->
37
39
  <script src="https://cdn.jsdelivr.net/npm/wisetrack/dist/cdn/sdk.bundle.min.js"></script>
@@ -41,6 +43,7 @@ pnpm add wisetrack
41
43
  ```
42
44
 
43
45
  ### Alternative CDNs
46
+
44
47
  ```html
45
48
  <!-- unpkg -->
46
49
  <script src="https://unpkg.com/wisetrack/dist/cdn/sdk.bundle.min.js"></script>
@@ -53,6 +56,7 @@ pnpm add wisetrack
53
56
  ### For npm/yarn installations (ES6 Modules)
54
57
 
55
58
  #### 1. Initialize the SDK
59
+
56
60
  ```typescript
57
61
  import { WiseTrack, WTUserEnvironment, WTLogLevel } from "wisetrack";
58
62
 
@@ -66,26 +70,45 @@ await WiseTrack.instance.init({
66
70
  ```
67
71
 
68
72
  #### 2. Start Tracking (Optional)
73
+
69
74
  ```typescript
70
75
  // Starts automatically if `startTrackerAutomatically` is true.
71
76
  // Otherwise, you can start manually:
72
77
  await WiseTrack.instance.startTracking();
73
78
  ```
74
79
 
75
- #### 3. Track a Custom Event
80
+ #### 3. Track Event
81
+
76
82
  ```typescript
77
83
  import { WTEvent } from "wisetrack";
78
84
 
85
+ // Default Event
79
86
  const signupEvent = new WTEvent.Default("signup");
80
87
  signupEvent.addParam("method", "Google");
81
88
  await WiseTrack.instance.trackEvent(signupEvent);
89
+
90
+ // Revenue Event
91
+ const purchase = new WTEvent.Revenue(
92
+ "order_completed",
93
+ 99.99,
94
+ RevenueCurrency.USD
95
+ );
96
+ purchase.addParam("item_id", "SKU-123");
97
+ await WiseTrack.instance.trackEvent(purchase);
82
98
  ```
83
99
 
100
+ **Note:** Event parameter keys and values have a maximum limit of 50 characters.
101
+
84
102
  #### 4. Track a Revenue Event
103
+
85
104
  ```typescript
86
105
  import { WTEvent, RevenueCurrency } from "wisetrack";
87
106
 
88
- const purchase = new WTEvent.Revenue("order_completed", 99.99, RevenueCurrency.USD);
107
+ const purchase = new WTEvent.Revenue(
108
+ "order_completed",
109
+ 99.99,
110
+ RevenueCurrency.USD
111
+ );
89
112
  purchase.addParam("item_id", "SKU-123");
90
113
  await WiseTrack.instance.trackEvent(purchase);
91
114
  ```
@@ -95,30 +118,31 @@ await WiseTrack.instance.trackEvent(purchase);
95
118
  ```html
96
119
  <!DOCTYPE html>
97
120
  <html>
98
- <head>
99
- <script src="https://cdn.jsdelivr.net/npm/wisetrack/dist/cdn/sdk.bundle.min.js"></script>
100
- </head>
101
- <body>
102
- <script>
103
- // Initialize
104
- WiseTrackSDK.WiseTrack.instance.init({
105
- appToken: "YOUR_APP_TOKEN",
106
- appVersion: "1.0.0",
107
- appFrameWork: "Vanilla JS",
108
- userEnvironment: WiseTrackSDK.WTUserEnvironment.SANDBOX,
109
- logLevel: WiseTrackSDK.WTLogLevel.DEBUG,
110
- });
111
-
112
- // Track event
113
- const signupEvent = new WiseTrackSDK.WTEvent.Default("signup");
114
- signupEvent.addParam("method", "Google");
115
- WiseTrackSDK.WiseTrack.instance.trackEvent(signupEvent);
116
- </script>
117
- </body>
121
+ <head>
122
+ <script src="https://cdn.jsdelivr.net/npm/wisetrack/dist/cdn/sdk.bundle.min.js"></script>
123
+ </head>
124
+ <body>
125
+ <script>
126
+ // Initialize
127
+ WiseTrackSDK.WiseTrack.instance.init({
128
+ appToken: "YOUR_APP_TOKEN",
129
+ appVersion: "1.0.0",
130
+ appFrameWork: "Vanilla JS",
131
+ userEnvironment: WiseTrackSDK.WTUserEnvironment.SANDBOX,
132
+ logLevel: WiseTrackSDK.WTLogLevel.DEBUG,
133
+ });
134
+
135
+ // Track event
136
+ const signupEvent = new WiseTrackSDK.WTEvent.Default("signup");
137
+ signupEvent.addParam("method", "Google");
138
+ WiseTrackSDK.WiseTrack.instance.trackEvent(signupEvent);
139
+ </script>
140
+ </body>
118
141
  </html>
119
142
  ```
120
143
 
121
144
  ### For CommonJS (Node.js)
145
+
122
146
  ```javascript
123
147
  const { WiseTrack, WTUserEnvironment, WTLogLevel } = require("wisetrack");
124
148
 
@@ -129,17 +153,17 @@ const { WiseTrack, WTUserEnvironment, WTLogLevel } = require("wisetrack");
129
153
 
130
154
  ## โš™๏ธ Configuration Options
131
155
 
132
- | Key | Required | Default | Description |
133
- | --------------------------- | -------- | ------- | -------------------------------------------------------------- |
134
- | `appToken` | โœ… | - | Your unique WiseTrack app token |
135
- | `appVersion` | โœ… | - | Your app version |
136
- | `appFrameWork` | โœ… | - | The framework/platform name |
137
- | `userEnvironment` | โŒ | `SANDBOX` | `WTUserEnvironment.SANDBOX` or `WTUserEnvironment.PRODUCTION` |
138
- | `trackingWaitingTime` | โŒ | `0` | Time in seconds to wait before tracking starts automatically |
139
- | `startTrackerAutomatically` | โŒ | `true` | Whether to start tracking automatically |
140
- | `customDeviceId` | โŒ | `auto` | Provide your own device ID |
141
- | `defaultTracker` | โŒ | - | Optional tracker name |
142
- | `logLevel` | โŒ | `ERROR` | Logging level (`WTLogLevel.DEBUG` / `INFO` / `WARN` / `ERROR`) |
156
+ | Key | Required | Default | Description |
157
+ | --------------------------- | -------- | --------- | -------------------------------------------------------------- |
158
+ | `appToken` | โœ… | - | Your unique WiseTrack app token |
159
+ | `appVersion` | โœ… | - | Your app version |
160
+ | `appFrameWork` | โœ… | - | The framework/platform name |
161
+ | `userEnvironment` | โŒ | `SANDBOX` | `WTUserEnvironment.SANDBOX` or `WTUserEnvironment.PRODUCTION` |
162
+ | `trackingWaitingTime` | โŒ | `0` | Time in seconds to wait before tracking starts automatically |
163
+ | `startTrackerAutomatically` | โŒ | `true` | Whether to start tracking automatically |
164
+ | `customDeviceId` | โŒ | `auto` | Provide your own device ID |
165
+ | `defaultTracker` | โŒ | - | Optional tracker name |
166
+ | `logLevel` | โŒ | `ERROR` | Logging level (`WTLogLevel.DEBUG` / `INFO` / `WARN` / `ERROR`) |
143
167
 
144
168
  ---
145
169
 
@@ -165,9 +189,10 @@ WiseTrack.instance.setLogLevel(WTLogLevel.DEBUG);
165
189
  ## ๐Ÿ—๏ธ Framework Examples
166
190
 
167
191
  ### React/Next.js
192
+
168
193
  ```tsx
169
- import { useEffect } from 'react';
170
- import { WiseTrack, WTUserEnvironment } from 'wisetrack';
194
+ import { useEffect } from "react";
195
+ import { WiseTrack, WTUserEnvironment } from "wisetrack";
171
196
 
172
197
  export default function App() {
173
198
  useEffect(() => {
@@ -184,10 +209,11 @@ export default function App() {
184
209
  ```
185
210
 
186
211
  ### Vue.js
212
+
187
213
  ```vue
188
214
  <script setup>
189
- import { onMounted } from 'vue';
190
- import { WiseTrack, WTUserEnvironment } from 'wisetrack';
215
+ import { onMounted } from "vue";
216
+ import { WiseTrack, WTUserEnvironment } from "wisetrack";
191
217
 
192
218
  onMounted(() => {
193
219
  WiseTrack.instance.init({
@@ -201,13 +227,14 @@ onMounted(() => {
201
227
  ```
202
228
 
203
229
  ### Angular
230
+
204
231
  ```typescript
205
- import { Component, OnInit } from '@angular/core';
206
- import { WiseTrack, WTUserEnvironment } from 'wisetrack';
232
+ import { Component, OnInit } from "@angular/core";
233
+ import { WiseTrack, WTUserEnvironment } from "wisetrack";
207
234
 
208
235
  @Component({
209
- selector: 'app-root',
210
- templateUrl: './app.component.html'
236
+ selector: "app-root",
237
+ templateUrl: "./app.component.html",
211
238
  })
212
239
  export class AppComponent implements OnInit {
213
240
  async ngOnInit() {
@@ -225,11 +252,11 @@ export class AppComponent implements OnInit {
225
252
 
226
253
  ## ๐Ÿ“Š Bundle Size & Performance
227
254
 
228
- | Build Type | Size (Minified) | Size (Gzipped) | Use Case |
229
- |------------|----------------|----------------|----------|
230
- | ESM | ~45KB | ~12KB | Modern bundlers (Webpack, Vite) |
231
- | CommonJS | ~45KB | ~12KB | Node.js, older bundlers |
232
- | CDN Bundle | ~25KB | ~8KB | Direct browser usage |
255
+ | Build Type | Size (Minified) | Size (Gzipped) | Use Case |
256
+ | ---------- | --------------- | -------------- | ------------------------------- |
257
+ | ESM | ~45KB | ~12KB | Modern bundlers (Webpack, Vite) |
258
+ | CommonJS | ~45KB | ~12KB | Node.js, older bundlers |
259
+ | CDN Bundle | ~25KB | ~8KB | Direct browser usage |
233
260
 
234
261
  ---
235
262
 
@@ -238,7 +265,7 @@ export class AppComponent implements OnInit {
238
265
  This package includes TypeScript definitions out of the box. No need to install additional `@types` packages.
239
266
 
240
267
  ```typescript
241
- import type { WTConfig, WTEventData } from 'wisetrack';
268
+ import type { WTConfig, WTEventData } from "wisetrack";
242
269
 
243
270
  const config: WTConfig = {
244
271
  appToken: "YOUR_APP_TOKEN",
@@ -252,11 +279,11 @@ const config: WTConfig = {
252
279
  ## ๐Ÿงช Browser Compatibility
253
280
 
254
281
  | Browser | Version |
255
- |---------|---------|
256
- | Chrome | โ‰ฅ 60 |
257
- | Firefox | โ‰ฅ 60 |
258
- | Safari | โ‰ฅ 12 |
259
- | Edge | โ‰ฅ 79 |
282
+ | ------- | ------- |
283
+ | Chrome | โ‰ฅ 60 |
284
+ | Firefox | โ‰ฅ 60 |
285
+ | Safari | โ‰ฅ 12 |
286
+ | Edge | โ‰ฅ 79 |
260
287
 
261
288
  ---
262
289
 
@@ -277,4 +304,4 @@ See [CHANGELOG.md](CHANGELOG.md) for a list of changes.
277
304
 
278
305
  ## ๐Ÿ“ License
279
306
 
280
- MIT ยฉ [WiseTrack](https://wisetrack.io)
307
+ MIT ยฉ [WiseTrack](https://wisetrack.io)