teacupweb 2.2.1 → 2.2.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/CHANGELOG.md +10 -2
- package/README.md +25 -24
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,26 +5,29 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
## [1.1.0] - 2025-12-26
|
|
10
9
|
|
|
11
10
|
### Added
|
|
11
|
+
|
|
12
12
|
- **Duplicate Prevention System**: Analytics data is now compared with previously sent data to prevent duplicates from being stored in the database
|
|
13
13
|
- **LocalStorage Fingerprint**: Visitor fingerprint now persists in localStorage across browser sessions for consistent identification
|
|
14
14
|
- `getNewData()` function in data controller that filters out duplicate analytics before sending
|
|
15
15
|
|
|
16
16
|
### Changed
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
- Fingerprint generation now happens only once per browser and is stored in localStorage with key `teacup_fingerprint`
|
|
18
19
|
- Analytics save function now only sends API requests when there is new data to transmit
|
|
19
20
|
- Data comparison logic ensures button clicks, page views, and form interactions are only sent once
|
|
20
21
|
|
|
21
22
|
### Fixed
|
|
23
|
+
|
|
22
24
|
- Duplicate button clicks on the same page are no longer sent multiple times
|
|
23
25
|
- Same page scroll percentages are no longer duplicated in database
|
|
24
26
|
- Form completion percentages only update when they change
|
|
25
27
|
- Reduced unnecessary API calls when no new analytics data is available
|
|
26
28
|
|
|
27
29
|
### Performance
|
|
30
|
+
|
|
28
31
|
- Reduced database writes by filtering duplicates before transmission
|
|
29
32
|
- Reduced network requests by skipping empty data intervals
|
|
30
33
|
- Fingerprint generation optimized to run only once per browser session
|
|
@@ -32,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
32
35
|
## [1.0.0] - 2025-12-17
|
|
33
36
|
|
|
34
37
|
### Added
|
|
38
|
+
|
|
35
39
|
- Initial release of TeacupNet Library
|
|
36
40
|
- Analytics tracking module with automatic data collection
|
|
37
41
|
- Button click tracking across all pages
|
|
@@ -45,7 +49,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
45
49
|
- TypeScript definitions for better IDE support
|
|
46
50
|
|
|
47
51
|
### Features
|
|
52
|
+
|
|
48
53
|
- **Analytics Module**
|
|
54
|
+
|
|
49
55
|
- `analytics.track()` - Start automatic tracking of user interactions
|
|
50
56
|
- Real-time button click tracking
|
|
51
57
|
- Scroll depth monitoring with percentage calculation
|
|
@@ -58,6 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
58
64
|
- `data.postData(inboxId, data)` - Post data to inbox
|
|
59
65
|
|
|
60
66
|
### Technical Details
|
|
67
|
+
|
|
61
68
|
- ES modules support
|
|
62
69
|
- Production-ready with Vercel backend integration
|
|
63
70
|
- Browser-based fingerprinting for visitor tracking
|
|
@@ -67,6 +74,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
67
74
|
## [Unreleased]
|
|
68
75
|
|
|
69
76
|
### Planned
|
|
77
|
+
|
|
70
78
|
- Custom event tracking
|
|
71
79
|
- Configurable sync intervals
|
|
72
80
|
- Offline data queue
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Teacup Library
|
|
2
2
|
|
|
3
|
-
A powerful JavaScript library for integrating
|
|
3
|
+
A powerful JavaScript library for integrating Teacup analytics and data management capabilities into your web applications. Track user interactions, page views, form completions, and seamlessly connect to the Teacup backend.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ A powerful JavaScript library for integrating TeacupNet analytics and data manag
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
|
-
npm install
|
|
17
|
+
npm install teacupweb
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Quick Start
|
|
@@ -22,24 +22,24 @@ npm install teacupnet-lib
|
|
|
22
22
|
### 1. Initialize the Library
|
|
23
23
|
|
|
24
24
|
```javascript
|
|
25
|
-
import
|
|
25
|
+
import teacup from 'teacupweb';
|
|
26
26
|
|
|
27
27
|
// Initialize with your credentials
|
|
28
|
-
const client =
|
|
28
|
+
const client = teacup('YOUR_CLIENT_ID', 'YOUR_CLIENT_KEY');
|
|
29
29
|
|
|
30
30
|
if (client.error) {
|
|
31
31
|
console.error(client.message);
|
|
32
32
|
} else {
|
|
33
|
-
console.log('
|
|
33
|
+
console.log('Teacup initialized successfully!');
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### 2. Enable Analytics Tracking
|
|
38
38
|
|
|
39
39
|
```javascript
|
|
40
|
-
import
|
|
40
|
+
import teacup from 'teacupweb';
|
|
41
41
|
|
|
42
|
-
const client =
|
|
42
|
+
const client = teacup('YOUR_CLIENT_ID', 'YOUR_CLIENT_KEY');
|
|
43
43
|
|
|
44
44
|
// Start tracking analytics
|
|
45
45
|
client.analytics.track();
|
|
@@ -55,9 +55,9 @@ That's it! The library will now automatically track:
|
|
|
55
55
|
|
|
56
56
|
### Initialization
|
|
57
57
|
|
|
58
|
-
#### `
|
|
58
|
+
#### `teacup(clientID, clientKey)`
|
|
59
59
|
|
|
60
|
-
Initializes the
|
|
60
|
+
Initializes the Teacup library with your credentials.
|
|
61
61
|
|
|
62
62
|
**Parameters:**
|
|
63
63
|
|
|
@@ -72,7 +72,7 @@ Initializes the TeacupNet library with your credentials.
|
|
|
72
72
|
**Example:**
|
|
73
73
|
|
|
74
74
|
```javascript
|
|
75
|
-
const client =
|
|
75
|
+
const client = teacup('123', 'secretKey456');
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
### Analytics Module
|
|
@@ -223,9 +223,9 @@ Tracks form completion in real-time:
|
|
|
223
223
|
If you want more control over tracking:
|
|
224
224
|
|
|
225
225
|
```javascript
|
|
226
|
-
import
|
|
226
|
+
import teacup from 'teacupweb';
|
|
227
227
|
|
|
228
|
-
const client =
|
|
228
|
+
const client = teacup('YOUR_CLIENT_ID', 'YOUR_CLIENT_KEY');
|
|
229
229
|
|
|
230
230
|
// Enable only specific tracking
|
|
231
231
|
// Note: This requires manual implementation
|
|
@@ -239,11 +239,11 @@ The library works seamlessly with modern frameworks:
|
|
|
239
239
|
```javascript
|
|
240
240
|
// React example
|
|
241
241
|
import { useEffect } from 'react';
|
|
242
|
-
import
|
|
242
|
+
import teacup from 'teacupweb';
|
|
243
243
|
|
|
244
244
|
function App() {
|
|
245
245
|
useEffect(() => {
|
|
246
|
-
const client =
|
|
246
|
+
const client = teacup(
|
|
247
247
|
process.env.REACT_APP_CLIENT_ID,
|
|
248
248
|
process.env.REACT_APP_CLIENT_KEY
|
|
249
249
|
);
|
|
@@ -259,10 +259,10 @@ function App() {
|
|
|
259
259
|
|
|
260
260
|
## Data Synchronization
|
|
261
261
|
|
|
262
|
-
Analytics data is automatically sent to the
|
|
262
|
+
Analytics data is automatically sent to the Teacup backend:
|
|
263
263
|
|
|
264
264
|
- **Interval**: Every 5 seconds
|
|
265
|
-
- **Endpoint**: `https://
|
|
265
|
+
- **Endpoint**: `https://backend.teacup.website/api/analytics`
|
|
266
266
|
- **Included**: Fingerprint, client credentials, and collected analytics data
|
|
267
267
|
|
|
268
268
|
## Browser Support
|
|
@@ -283,8 +283,8 @@ Analytics data is automatically sent to the TeacupNet backend:
|
|
|
283
283
|
**Example `.env` file:**
|
|
284
284
|
|
|
285
285
|
```env
|
|
286
|
-
|
|
287
|
-
|
|
286
|
+
TEACUP_CLIENT_ID=your_client_id
|
|
287
|
+
TEACUP_CLIENT_KEY=your_client_key
|
|
288
288
|
```
|
|
289
289
|
|
|
290
290
|
## Troubleshooting
|
|
@@ -294,7 +294,7 @@ TEACUPNET_CLIENT_KEY=your_client_key
|
|
|
294
294
|
Make sure you've called `client.analytics.track()` after initialization:
|
|
295
295
|
|
|
296
296
|
```javascript
|
|
297
|
-
const client =
|
|
297
|
+
const client = teacup('CLIENT_ID', 'CLIENT_KEY');
|
|
298
298
|
client.analytics.track(); // Don't forget this!
|
|
299
299
|
```
|
|
300
300
|
|
|
@@ -303,7 +303,7 @@ client.analytics.track(); // Don't forget this!
|
|
|
303
303
|
Verify your `clientID` and `clientKey` are correct:
|
|
304
304
|
|
|
305
305
|
```javascript
|
|
306
|
-
const client =
|
|
306
|
+
const client = teacup('CLIENT_ID', 'CLIENT_KEY');
|
|
307
307
|
if (client.error) {
|
|
308
308
|
console.error('Initialization failed:', client.message);
|
|
309
309
|
}
|
|
@@ -319,12 +319,13 @@ if (client.error) {
|
|
|
319
319
|
|
|
320
320
|
For issues, questions, or feature requests:
|
|
321
321
|
|
|
322
|
-
- GitHub Issues: [https://github.com/tahmidjihan/
|
|
323
|
-
- Repository: [https://github.com/tahmidjihan/
|
|
322
|
+
- GitHub Issues: [https://github.com/tahmidjihan/teacup-lib/issues](https://github.com/tahmidjihan/teacup-lib/issues)
|
|
323
|
+
- Repository: [https://github.com/tahmidjihan/teacup-lib](https://github.com/tahmidjihan/teacup-lib)
|
|
324
|
+
- Website: [https://teacup.website](https://teacup.website)
|
|
324
325
|
|
|
325
326
|
## License
|
|
326
327
|
|
|
327
|
-
ISC © Tahmid Jihan,
|
|
328
|
+
ISC © Tahmid Jihan, Teacup
|
|
328
329
|
|
|
329
330
|
## Changelog
|
|
330
331
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teacupweb",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "A powerful JavaScript library for integrating Teacup analytics and data management. Track user interactions, page views, form completions, and seamlessly connect to the Teacup backend.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"analytics",
|