@reservamos/browser-analytics 1.1.3 → 1.1.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/CHANGELOG.md +9 -0
- package/README.md +15 -0
- package/dist/browser-analytics.cjs +1 -1
- package/dist/browser-analytics.cjs.map +1 -1
- package/dist/browser-analytics.d.ts +22 -0
- package/dist/browser-analytics.esm.js +28 -16
- package/dist/browser-analytics.esm.js.map +1 -1
- package/dist/browser-analytics.iife.js +1 -1
- package/dist/browser-analytics.iife.js.map +1 -1
- package/package.json +5 -1
- package/src/events/purchaseConfirmation/index.ts +7 -0
- package/src/events/purchaseConfirmation/purchaseConfirmation.test.ts +102 -0
- package/src/events/purchaseConfirmation/purchaseConfirmationSchema.ts +15 -0
- package/src/events/purchaseConfirmation/trackPurchaseConfirmation.ts +19 -0
- package/src/index.ts +4 -0
- package/src/services/validator/validator.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 1.1.5
|
|
4
|
+
|
|
5
|
+
- Migrate npm releases from long-lived token authentication to npm Trusted Publishing with GitHub Actions OIDC.
|
|
6
|
+
- Keep public package distribution on `registry.npmjs.org` with no installation changes required for consumers.
|
|
7
|
+
|
|
8
|
+
## 1.1.4
|
|
9
|
+
|
|
10
|
+
- Add `analytics.track.purchaseConfirmation` to send a `Purchase Confirmation Viewed` event when the confirmation or pending-payment page is viewed. Requires `order_number` and `payment_status` (`confirmed` | `pending_pix`); `payment_type` and `total` are optional.
|
|
11
|
+
|
|
3
12
|
## 1.1.3
|
|
4
13
|
|
|
5
14
|
- Add optional `appName` to `InitConfig`. When provided, the library sends it as the `x-app-name` HTTP header on Datalake identify and anonymous-profile requests so the API can attribute traffic to the originating client platform.
|
package/README.md
CHANGED
|
@@ -64,6 +64,21 @@ analytics.identify('main-identifier', {
|
|
|
64
64
|
});
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
## Tracking Purchase Confirmation
|
|
68
|
+
|
|
69
|
+
The `purchaseConfirmation` event reports that a purchase confirmation or pending-payment page was viewed, so the order can be joined back to the visitor's Mixpanel `distinct_id`. `order_number` and `payment_status` (`'confirmed' | 'pending_pix'`) are required; `payment_type` and `total` are optional.
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import analytics from '@reservamos/browser-analytics';
|
|
73
|
+
|
|
74
|
+
analytics.track.purchaseConfirmation({
|
|
75
|
+
order_number: 'MOB-123456',
|
|
76
|
+
payment_status: 'confirmed',
|
|
77
|
+
payment_type: 'credit_card',
|
|
78
|
+
total: 199.9,
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
67
82
|
## Development workflow (OpenSpec)
|
|
68
83
|
|
|
69
84
|
This repo uses [OpenSpec](https://github.com/Fission-AI/OpenSpec) for spec-driven development. Changes are planned as artifacts under `openspec/changes/` before implementation.
|