@getdevteam/analytics-web 0.1.0-dev.1 → 0.1.0-dev.2
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 +33 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @getdevteam/analytics-web
|
|
2
|
+
|
|
3
|
+
Browser SDK for the [DevTeam Analytics & Logging Platform](https://github.com/getdevteam-ai/analytics).
|
|
4
|
+
Drop it into any browser app - plain JS, Astro, Vue, Svelte, or React without the hooks - to send analytics events and logs.
|
|
5
|
+
Building with React and want a `useAnalytics()` hook? Pair this with [`@getdevteam/analytics-react`](https://www.npmjs.com/package/@getdevteam/analytics-react).
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @getdevteam/analytics-web
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Use
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { createAnalytics } from "@getdevteam/analytics-web";
|
|
17
|
+
|
|
18
|
+
const analytics = createAnalytics({
|
|
19
|
+
key: "dtp_your_public_key",
|
|
20
|
+
host: "https://ingest.analytics.getdevteam.ai",
|
|
21
|
+
trackPageviews: true, // auto-send a pageview on every route change
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
analytics.identify("user_123", { plan: "pro" }); // who the user is
|
|
25
|
+
analytics.track("checkout_completed", { amount: 4200 }); // something that happened
|
|
26
|
+
analytics.log.error("payment gateway timed out", { gateway: "stripe" });
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Auto-captures uncaught errors and unhandled promise rejections (turn off with `autoCaptureErrors: false`), and flushes queued events when the page is hidden or closed so nothing is lost on navigation.
|
|
30
|
+
|
|
31
|
+
You need a public ingest key (`dtp_...`) and the ingest host URL for your environment - see [Getting a key](https://github.com/getdevteam-ai/analytics/tree/main/src/sdk#getting-a-key) in the full SDK docs.
|
|
32
|
+
|
|
33
|
+
Full client API, config options, and release process: [src/sdk README](https://github.com/getdevteam-ai/analytics/tree/main/src/sdk).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getdevteam/analytics-web",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.2",
|
|
4
4
|
"description": "Browser SDK for the DevTeam analytics and logging platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typecheck": "tsc --noEmit"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@getdevteam/analytics-core": "0.1.0-dev.
|
|
40
|
+
"@getdevteam/analytics-core": "0.1.0-dev.2"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"jsdom": "^26.1.0",
|