@funnelsgrove/analytics 0.1.27 → 0.1.28
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 +40 -23
- package/dist/index.js +3 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,38 +1,55 @@
|
|
|
1
1
|
# @funnelsgrove/analytics
|
|
2
2
|
|
|
3
|
-
Shared
|
|
3
|
+
Shared analytics package for public funnels.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Read this file before editing analytics code. Deeper runtime SDK docs live in
|
|
6
|
+
[`docs/funnel-sdk/analytics-sdk.md`](../../docs/funnel-sdk/analytics-sdk.md).
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
- The build normalizes generated relative ESM imports to explicit `.js` files for published package consumers.
|
|
8
|
+
## Owns event identity and delivery
|
|
9
|
+
|
|
10
|
+
`@funnelsgrove/analytics` owns the browser identity, event-shaping, and delivery contract for public funnel analytics. Funnel code may decide when a business event happened, but this package decides how that event becomes a normalized SDK/PostHog/partner payload.
|
|
11
11
|
|
|
12
12
|
## Use This Package For
|
|
13
13
|
|
|
14
14
|
- browser user-id persistence
|
|
15
|
+
- SDK user bootstrap for public funnel identity
|
|
15
16
|
- public analytics event batching and transport
|
|
16
|
-
- identify
|
|
17
|
-
-
|
|
18
|
-
-
|
|
17
|
+
- identify, track, step lifecycle, and checkout event helpers
|
|
18
|
+
- Stripe purchase metadata shaping before payment metadata reaches the API
|
|
19
|
+
- Google Tag and Meta Pixel event adapters
|
|
20
|
+
- local-only no-op behavior when a real publishable key is not configured
|
|
19
21
|
|
|
20
|
-
##
|
|
22
|
+
## Do Not Use This Package For
|
|
21
23
|
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
24
|
+
- step routing
|
|
25
|
+
- manifest logic
|
|
26
|
+
- checkout orchestration
|
|
27
|
+
- billing plan resolution
|
|
28
|
+
- Stripe checkout UI
|
|
29
|
+
- funnel-specific step components or copy
|
|
26
30
|
|
|
27
|
-
##
|
|
31
|
+
## Public Surfaces
|
|
28
32
|
|
|
29
|
-
-
|
|
30
|
-
- public SDK
|
|
31
|
-
-
|
|
33
|
+
- `publicAnalyticsSdk`: the canonical browser SDK for identify, track, lifecycle, checkout, and flush calls.
|
|
34
|
+
- `bootstrapPublicAnalyticsUser`: public SDK identity bootstrap helper.
|
|
35
|
+
- `sdk-user-id.storage`: shared browser user-id storage contract.
|
|
36
|
+
- `buildStripePurchaseMetadata` and purchase attribute helpers: safe metadata shaping for payment handoff.
|
|
37
|
+
- `google-tag.service` and `meta-pixel.service`: partner event adapters.
|
|
38
|
+
- `experiment-result-metrics.service`: shared experiment result metric helpers.
|
|
32
39
|
|
|
33
|
-
##
|
|
40
|
+
## Engineering Rules
|
|
34
41
|
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
42
|
+
- Keep transport details here; do not duplicate event batching in funnels.
|
|
43
|
+
- Keep provider adapters dumb: they map canonical events, not funnel business flow.
|
|
44
|
+
- Do not import payment UI or runtime routing from this package.
|
|
45
|
+
- Sensitive values must be filtered before metadata reaches Stripe or partner tools.
|
|
46
|
+
|
|
47
|
+
## Build, Test, Publish
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run test:run --workspace @funnelsgrove/analytics
|
|
51
|
+
npm run build --workspace @funnelsgrove/analytics
|
|
52
|
+
npm publish --workspace @funnelsgrove/analytics --access public
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The build normalizes generated relative ESM imports to explicit `.js` files for published package consumers.
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
// Runtime API and identity.
|
|
1
2
|
export * from './services/runtime-api.config.js';
|
|
2
3
|
export * from './services/sdk-user-id.storage.js';
|
|
3
4
|
export * from './services/bootstrap-public-analytics-user.js';
|
|
5
|
+
// Partner adapters.
|
|
4
6
|
export * from './services/google-tag.service.js';
|
|
5
7
|
export * from './services/meta-pixel.service.js';
|
|
8
|
+
// Purchase and event transport.
|
|
6
9
|
export * from './services/purchase-attributes.service.js';
|
|
7
10
|
export * from './services/public-analytics-sdk.service.js';
|
|
8
11
|
export * from './services/experiment-result-metrics.service.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnelsgrove/analytics",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"test:run": "vitest run --passWithNoTests"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@funnelsgrove/runtime": "0.1.
|
|
34
|
+
"@funnelsgrove/runtime": "0.1.45"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^20",
|