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