@eventra_dev/eventra-sdk 0.1.10 → 1.0.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 +96 -14
- package/dist/{index.cjs → index.js} +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- /package/dist/{index.cjs.map → index.js.map} +0 -0
package/README.md
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
Eventra SDK allows you to send **feature usage and product analytics events** to the Eventra platform.
|
|
8
8
|
|
|
9
|
+
Eventra helps you:
|
|
10
|
+
|
|
11
|
+
- Track feature adoption
|
|
12
|
+
- Detect unused features
|
|
13
|
+
- Understand user behavior
|
|
14
|
+
- Monitor backend usage
|
|
15
|
+
- Analyze product growth
|
|
16
|
+
|
|
9
17
|
It is designed to be:
|
|
10
18
|
|
|
11
19
|
* lightweight
|
|
@@ -54,6 +62,94 @@ tracker.track("checkout.completed", {
|
|
|
54
62
|
});
|
|
55
63
|
```
|
|
56
64
|
|
|
65
|
+
That's it. Events are automatically:
|
|
66
|
+
|
|
67
|
+
- batched
|
|
68
|
+
- retried
|
|
69
|
+
- flushed
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
# Event Properties
|
|
74
|
+
|
|
75
|
+
Eventra allows you to pass **optional properties** with every event.
|
|
76
|
+
|
|
77
|
+
Properties are completely flexible — you can send **any JSON-compatible data**.
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
tracker.track("checkout.completed", {
|
|
81
|
+
userId: "user_123",
|
|
82
|
+
properties: {
|
|
83
|
+
plan: "pro",
|
|
84
|
+
price: 29,
|
|
85
|
+
currency: "USD"
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Properties are optional:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
tracker.track("app.loaded");
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Or with userId only:
|
|
97
|
+
|
|
98
|
+
```ts
|
|
99
|
+
tracker.track("user.login", {
|
|
100
|
+
userId: "user_123"
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
# Common Examples
|
|
107
|
+
|
|
108
|
+
## Feature Usage
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
tracker.track("feature.used", {
|
|
112
|
+
userId: "user_123",
|
|
113
|
+
properties: {
|
|
114
|
+
feature: "dashboard",
|
|
115
|
+
section: "analytics"
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Page View
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
tracker.track("page.viewed", {
|
|
124
|
+
properties: {
|
|
125
|
+
path: window.location.pathname
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## API Usage
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
tracker.track("api.request", {
|
|
134
|
+
properties: {
|
|
135
|
+
endpoint: "/checkout",
|
|
136
|
+
method: "POST",
|
|
137
|
+
status: 200
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Error Tracking
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
tracker.track("error.occurred", {
|
|
146
|
+
properties: {
|
|
147
|
+
message: "Payment failed",
|
|
148
|
+
code: "PAYMENT_ERROR"
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
57
153
|
---
|
|
58
154
|
|
|
59
155
|
# Where You Can Use Eventra SDK
|
|
@@ -208,8 +304,6 @@ app.post("/checkout", (req, res) => {
|
|
|
208
304
|
|
|
209
305
|
# Vanilla JavaScript (CDN)
|
|
210
306
|
|
|
211
|
-
You can use Eventra without a bundler.
|
|
212
|
-
|
|
213
307
|
```html
|
|
214
308
|
<script type="module">
|
|
215
309
|
|
|
@@ -228,8 +322,6 @@ tracker.track("page.viewed");
|
|
|
228
322
|
|
|
229
323
|
# Configuration
|
|
230
324
|
|
|
231
|
-
You can configure the SDK behaviour.
|
|
232
|
-
|
|
233
325
|
```ts
|
|
234
326
|
const eventra = new Eventra({
|
|
235
327
|
|
|
@@ -261,8 +353,6 @@ const eventra = new Eventra({
|
|
|
261
353
|
|
|
262
354
|
# Multi-Tab Mode (Browser)
|
|
263
355
|
|
|
264
|
-
To avoid duplicate event sending across multiple tabs:
|
|
265
|
-
|
|
266
356
|
```ts
|
|
267
357
|
const tracker = new Eventra({
|
|
268
358
|
apiKey: "YOUR_PROJECT_API_KEY",
|
|
@@ -330,14 +420,6 @@ Events are sent in batches:
|
|
|
330
420
|
|
|
331
421
|
---
|
|
332
422
|
|
|
333
|
-
# Error Handling
|
|
334
|
-
|
|
335
|
-
Client errors (4xx) are **not retried**.
|
|
336
|
-
|
|
337
|
-
Server errors (5xx) are retried using **exponential backoff**.
|
|
338
|
-
|
|
339
|
-
---
|
|
340
|
-
|
|
341
423
|
# Documentation
|
|
342
424
|
|
|
343
425
|
Full documentation:
|
|
@@ -25,7 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
|
|
27
27
|
// src/client.ts
|
|
28
|
-
var SDK_VERSION = "0.1
|
|
28
|
+
var SDK_VERSION = "1.0.1";
|
|
29
29
|
var DEFAULTS = {
|
|
30
30
|
endpoint: "https://api.eventra.dev/api/v1/ingest/batch",
|
|
31
31
|
flushInterval: 2e3,
|
|
@@ -259,4 +259,4 @@ var Eventra = class {
|
|
|
259
259
|
0 && (module.exports = {
|
|
260
260
|
Eventra
|
|
261
261
|
});
|
|
262
|
-
//# sourceMappingURL=index.
|
|
262
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
File without changes
|