wisetrack 2.0.3 โ†’ 2.0.6

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,59 +70,65 @@ 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);
82
- ```
83
-
84
- #### 4. Track a Revenue Event
85
- ```typescript
86
- import { WTEvent, RevenueCurrency } from "wisetrack";
87
89
 
88
- const purchase = new WTEvent.Revenue("order_completed", 99.99, RevenueCurrency.USD);
90
+ // Revenue Event
91
+ const purchase = new WTEvent.Revenue(
92
+ "order_completed",
93
+ 99.99,
94
+ RevenueCurrency.USD
95
+ );
89
96
  purchase.addParam("item_id", "SKU-123");
90
97
  await WiseTrack.instance.trackEvent(purchase);
91
98
  ```
92
99
 
100
+ **Note:** Event parameter keys and values have a maximum limit of 50 characters.
101
+
93
102
  ### For CDN usage (Direct Browser)
94
103
 
95
104
  ```html
96
105
  <!DOCTYPE html>
97
106
  <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>
107
+ <head>
108
+ <script src="https://cdn.jsdelivr.net/npm/wisetrack/dist/cdn/sdk.bundle.min.js"></script>
109
+ </head>
110
+ <body>
111
+ <script>
112
+ // Initialize
113
+ WiseTrackSDK.WiseTrack.instance.init({
114
+ appToken: "YOUR_APP_TOKEN",
115
+ appVersion: "1.0.0",
116
+ appFrameWork: "Vanilla JS",
117
+ userEnvironment: WiseTrackSDK.WTUserEnvironment.SANDBOX,
118
+ logLevel: WiseTrackSDK.WTLogLevel.DEBUG,
119
+ });
120
+
121
+ // Track event
122
+ const signupEvent = new WiseTrackSDK.WTEvent.Default("signup");
123
+ signupEvent.addParam("method", "Google");
124
+ WiseTrackSDK.WiseTrack.instance.trackEvent(signupEvent);
125
+ </script>
126
+ </body>
118
127
  </html>
119
128
  ```
120
129
 
121
130
  ### For CommonJS (Node.js)
131
+
122
132
  ```javascript
123
133
  const { WiseTrack, WTUserEnvironment, WTLogLevel } = require("wisetrack");
124
134
 
@@ -129,17 +139,17 @@ const { WiseTrack, WTUserEnvironment, WTLogLevel } = require("wisetrack");
129
139
 
130
140
  ## โš™๏ธ Configuration Options
131
141
 
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`) |
142
+ | Key | Required | Default | Description |
143
+ | --------------------------- | -------- | --------- | -------------------------------------------------------------- |
144
+ | `appToken` | โœ… | - | Your unique WiseTrack app token |
145
+ | `appVersion` | โœ… | - | Your app version |
146
+ | `appFrameWork` | โœ… | - | The framework/platform name |
147
+ | `userEnvironment` | โŒ | `SANDBOX` | `WTUserEnvironment.SANDBOX` or `WTUserEnvironment.PRODUCTION` |
148
+ | `trackingWaitingTime` | โŒ | `0` | Time in seconds to wait before tracking starts automatically |
149
+ | `startTrackerAutomatically` | โŒ | `true` | Whether to start tracking automatically |
150
+ | `customDeviceId` | โŒ | `auto` | Provide your own device ID |
151
+ | `defaultTracker` | โŒ | - | Optional tracker name |
152
+ | `logLevel` | โŒ | `ERROR` | Logging level (`WTLogLevel.DEBUG` / `INFO` / `WARN` / `ERROR`) |
143
153
 
144
154
  ---
145
155
 
@@ -165,9 +175,10 @@ WiseTrack.instance.setLogLevel(WTLogLevel.DEBUG);
165
175
  ## ๐Ÿ—๏ธ Framework Examples
166
176
 
167
177
  ### React/Next.js
178
+
168
179
  ```tsx
169
- import { useEffect } from 'react';
170
- import { WiseTrack, WTUserEnvironment } from 'wisetrack';
180
+ import { useEffect } from "react";
181
+ import { WiseTrack, WTUserEnvironment } from "wisetrack";
171
182
 
172
183
  export default function App() {
173
184
  useEffect(() => {
@@ -184,10 +195,11 @@ export default function App() {
184
195
  ```
185
196
 
186
197
  ### Vue.js
198
+
187
199
  ```vue
188
200
  <script setup>
189
- import { onMounted } from 'vue';
190
- import { WiseTrack, WTUserEnvironment } from 'wisetrack';
201
+ import { onMounted } from "vue";
202
+ import { WiseTrack, WTUserEnvironment } from "wisetrack";
191
203
 
192
204
  onMounted(() => {
193
205
  WiseTrack.instance.init({
@@ -201,13 +213,14 @@ onMounted(() => {
201
213
  ```
202
214
 
203
215
  ### Angular
216
+
204
217
  ```typescript
205
- import { Component, OnInit } from '@angular/core';
206
- import { WiseTrack, WTUserEnvironment } from 'wisetrack';
218
+ import { Component, OnInit } from "@angular/core";
219
+ import { WiseTrack, WTUserEnvironment } from "wisetrack";
207
220
 
208
221
  @Component({
209
- selector: 'app-root',
210
- templateUrl: './app.component.html'
222
+ selector: "app-root",
223
+ templateUrl: "./app.component.html",
211
224
  })
212
225
  export class AppComponent implements OnInit {
213
226
  async ngOnInit() {
@@ -225,11 +238,11 @@ export class AppComponent implements OnInit {
225
238
 
226
239
  ## ๐Ÿ“Š Bundle Size & Performance
227
240
 
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 |
241
+ | Build Type | Size (Minified) | Size (Gzipped) | Use Case |
242
+ | ---------- | --------------- | -------------- | ------------------------------- |
243
+ | ESM | ~45KB | ~12KB | Modern bundlers (Webpack, Vite) |
244
+ | CommonJS | ~45KB | ~12KB | Node.js, older bundlers |
245
+ | CDN Bundle | ~25KB | ~8KB | Direct browser usage |
233
246
 
234
247
  ---
235
248
 
@@ -238,7 +251,7 @@ export class AppComponent implements OnInit {
238
251
  This package includes TypeScript definitions out of the box. No need to install additional `@types` packages.
239
252
 
240
253
  ```typescript
241
- import type { WTConfig, WTEventData } from 'wisetrack';
254
+ import type { WTConfig, WTEventData } from "wisetrack";
242
255
 
243
256
  const config: WTConfig = {
244
257
  appToken: "YOUR_APP_TOKEN",
@@ -252,11 +265,11 @@ const config: WTConfig = {
252
265
  ## ๐Ÿงช Browser Compatibility
253
266
 
254
267
  | Browser | Version |
255
- |---------|---------|
256
- | Chrome | โ‰ฅ 60 |
257
- | Firefox | โ‰ฅ 60 |
258
- | Safari | โ‰ฅ 12 |
259
- | Edge | โ‰ฅ 79 |
268
+ | ------- | ------- |
269
+ | Chrome | โ‰ฅ 60 |
270
+ | Firefox | โ‰ฅ 60 |
271
+ | Safari | โ‰ฅ 12 |
272
+ | Edge | โ‰ฅ 79 |
260
273
 
261
274
  ---
262
275
 
@@ -277,4 +290,4 @@ See [CHANGELOG.md](CHANGELOG.md) for a list of changes.
277
290
 
278
291
  ## ๐Ÿ“ License
279
292
 
280
- MIT ยฉ [WiseTrack](https://wisetrack.io)
293
+ MIT ยฉ [WiseTrack](https://wisetrack.io)