@bluenath/engage 1.0.0 → 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.
Files changed (3) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +110 -0
  3. package/package.json +1 -1
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bluenath
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # @bluenath/engage
2
+
3
+ The intelligent, zero-configuration analytics SDK for modern React applications. @bluenath/engage automatically captures clicks, form submissions, and page views, using heuristic intelligence to classify user intent (Commerce, Frustration, Engagement) without manual tagging.
4
+
5
+ ## ✨ Features
6
+
7
+ - 🧠 **Auto-Capture Intelligence**: Automatically detects `ADD_TO_CART`, `CHECKOUT`, `REFUND`, and more by analyzing button text and DOM attributes.
8
+ - 😡 **Rage Click Detection**: Detects user frustration (rapid clicking) automatically.
9
+ - ⚡️ **Performance Monitoring**: Tracks Core Web Vitals (LCP, TTFB, Load Time) out of the box.
10
+ - 🔌 **Offline Support**: Queues events in LocalStorage when offline and syncs when connectivity returns.
11
+ - 🛡️ **PII Protection**: Automatically ignores password and credit card fields.
12
+ - ⚛️ **First-Class React Support**: Drop-in Provider component.
13
+
14
+ ## 🚀 Installation
15
+
16
+ ```bash
17
+ npm install @bluenath/engage
18
+ ```
19
+
20
+ or
21
+
22
+ ```bash
23
+ yarn add @bluenath/engage
24
+ ```
25
+
26
+ ## 🛠️ Usage
27
+
28
+ ### 1. Wrap your App
29
+
30
+ Wrap your root component with `EngageProProvider`. This single step enables auto-capture for the entire application.
31
+
32
+ ```jsx
33
+ import React from "react";
34
+ import ReactDOM from "react-dom/client";
35
+ import { EngageProProvider } from "@bluenath/engage";
36
+ import App from "./App";
37
+
38
+ const root = ReactDOM.createRoot(document.getElementById("root"));
39
+
40
+ root.render(
41
+ <EngageProProvider
42
+ writeKey="YOUR_WRITE_KEY"
43
+ apiHost="https://your-api.com/analyticsdk/ingest"
44
+ tracking={{
45
+ autoTrack: true, // 🧠 Enable Smart Sentinel
46
+ useCookies: true, // Persist session across subdomains
47
+ fingerprint: true, // Device fingerprinting for guest users
48
+ }}
49
+ >
50
+ <App />
51
+ </EngageProProvider>,
52
+ );
53
+ ```
54
+
55
+ ### 2. Manual Tracking (Optional)
56
+
57
+ While auto-capture handles 90% of events, you can manually track specific actions using the hook.
58
+
59
+ ```jsx
60
+ import { useAnalytics } from "@bluenath/engage";
61
+
62
+ const ProductPage = () => {
63
+ const { track, identify } = useAnalytics();
64
+
65
+ const handleLogin = (user) => {
66
+ // Stitch session to user ID
67
+ identify(user.id, {
68
+ email: user.email,
69
+ plan: "premium",
70
+ });
71
+ };
72
+
73
+ const handleCustomAction = () => {
74
+ track("Video Watched", {
75
+ duration: 120,
76
+ category: "Tutorial",
77
+ });
78
+ };
79
+
80
+ return <button onClick={handleCustomAction}>Play Video</button>;
81
+ };
82
+ ```
83
+
84
+ ## 🧠 Smart Events (Auto-Detected)
85
+
86
+ The SDK automatically maps user interactions to these standard events based on heuristics:
87
+
88
+ | Event Name | Trigger Logic (Example) |
89
+ | ------------------- | -------------------------------------------------- |
90
+ | `ADD_TO_CART` | Clicks on buttons labeled "Add to Cart", "Buy Now" |
91
+ | `INITIATE_CHECKOUT` | Clicks on "Checkout", "Proceed" |
92
+ | `PURCHASE` | Clicks on "Place Order", "Pay Now" |
93
+ | `ORDER_CANCEL` | Clicks on "Cancel Order" |
94
+ | `RAGE_CLICK` | 3+ rapid clicks on the same element (< 500ms) |
95
+ | `FORM_START` | User focuses on an input field |
96
+ | `PERFORMANCE` | Page Load metrics (TTFB, Load Time) |
97
+
98
+ ## 🔒 Configuration Options
99
+
100
+ | Prop | Type | Default | Description |
101
+ | --------------------- | --------- | -------- | ----------------------------------------- |
102
+ | `writeKey` | `string` | Required | Your project's API Key. |
103
+ | `apiHost` | `string` | `...` | The endpoint where events are sent. |
104
+ | `tracking.autoTrack` | `boolean` | `true` | Enables/Disables DOM listening. |
105
+ | `tracking.useCookies` | `boolean` | `false` | Use cookies for cross-subdomain tracking. |
106
+ | `debug` | `boolean` | `false` | Log events to console for debugging. |
107
+
108
+ ## 📄 License
109
+
110
+ MIT © Bluenath
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluenath/engage",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",