@se-studio/ab-testing 1.1.0 → 2.0.0
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
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @se-studio/ab-testing
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add `@se-studio/hubspot` shared package for HubSpot tracking (`HubSpotAnalyticsAdapter`) and API-driven form rendering with CMS external component support.
|
|
8
|
+
|
|
9
|
+
Add `CompositeAnalyticsAdapter` and `AnalyticsPageTracker` to core-ui for multi-provider analytics (GTM + HubSpot SPA Mode B).
|
|
10
|
+
|
|
11
|
+
Update `AbTestReporter` to route experiment impressions through `useAnalytics`, including `hubspot_event` for HubSpot behavioural events.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
- @se-studio/core-ui@1.9.0
|
|
15
|
+
|
|
3
16
|
## 1.1.0
|
|
4
17
|
|
|
5
18
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -157,6 +157,15 @@ export const config = {
|
|
|
157
157
|
};
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
+
#### Page-test route (static rebuild pattern)
|
|
161
|
+
|
|
162
|
+
When using `createStaticAbTestMiddleware` with `variantPathPrefix: '/page-test'`, add a `/page-test/[...slugs]` route that rewrites serve variant content on the control URL. Use `findCanonicalPath(testsByPath, variantSlug)` to resolve the user-facing path, then call the paired handlers from `@se-studio/core-ui/server`:
|
|
163
|
+
|
|
164
|
+
- `generatePageTestMetadata` — control `indexed` and canonical path in `<head>`
|
|
165
|
+
- `generatePageTest` — variant body with control identity for breadcrumbs, `href`, and JSON-LD
|
|
166
|
+
|
|
167
|
+
See the `se-marketing-sites-create-page` skill for the full route template. Direct visits to a variant's own CMS URL (normal page route) should keep using `generatePage`.
|
|
168
|
+
|
|
160
169
|
### 3. Create the Webhook Handler
|
|
161
170
|
|
|
162
171
|
```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbTestReporter.d.ts","sourceRoot":"","sources":["../../src/components/AbTestReporter.tsx"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"AbTestReporter.d.ts","sourceRoot":"","sources":["../../src/components/AbTestReporter.tsx"],"names":[],"mappings":"AAMA,wBAAgB,cAAc,SAuB7B"}
|
|
@@ -1,33 +1,26 @@
|
|
|
1
|
-
/** biome-ignore-all lint/suspicious/noConsole: A/B test debug logging */
|
|
2
1
|
'use client';
|
|
2
|
+
import { useAnalytics } from '@se-studio/core-ui';
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { useAbTestAssignments } from '../hooks/useAbTestAssignments';
|
|
5
5
|
export function AbTestReporter() {
|
|
6
6
|
const assignments = useAbTestAssignments();
|
|
7
|
+
const { trackEvent } = useAnalytics();
|
|
7
8
|
useEffect(() => {
|
|
8
|
-
|
|
9
|
-
if (assignments === null) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
if (assignments.length === 0) {
|
|
13
|
-
console.log('[A/B reporter] No active tests on this page');
|
|
9
|
+
if (assignments === null || assignments.length === 0) {
|
|
14
10
|
return;
|
|
15
11
|
}
|
|
16
12
|
for (const assignment of assignments) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
experiment_name: assignment.test_label,
|
|
26
|
-
variant_id: assignment.test_path,
|
|
27
|
-
utm_content: `${assignment.test_label}:${assignment.test_path}`,
|
|
13
|
+
trackEvent('experiment_impression', {
|
|
14
|
+
experimentId: assignment.testId,
|
|
15
|
+
experimentName: assignment.test_label,
|
|
16
|
+
variantId: assignment.test_path,
|
|
17
|
+
originalPath: assignment.original_path,
|
|
18
|
+
utmContent: `${assignment.test_label}:${assignment.test_path}`,
|
|
19
|
+
hubspotEvent: assignment.hubspot_event,
|
|
20
|
+
hubspot_event: assignment.hubspot_event,
|
|
28
21
|
});
|
|
29
22
|
}
|
|
30
|
-
}, [assignments]);
|
|
23
|
+
}, [assignments, trackEvent]);
|
|
31
24
|
return null;
|
|
32
25
|
}
|
|
33
26
|
//# sourceMappingURL=AbTestReporter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AbTestReporter.js","sourceRoot":"","sources":["../../src/components/AbTestReporter.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"AbTestReporter.js","sourceRoot":"","sources":["../../src/components/AbTestReporter.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,MAAM,UAAU,cAAc;IAC5B,MAAM,WAAW,GAAG,oBAAoB,EAAE,CAAC;IAC3C,MAAM,EAAE,UAAU,EAAE,GAAG,YAAY,EAAE,CAAC;IAEtC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrD,OAAO;QACT,CAAC;QAED,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,UAAU,CAAC,uBAAuB,EAAE;gBAClC,YAAY,EAAE,UAAU,CAAC,MAAM;gBAC/B,cAAc,EAAE,UAAU,CAAC,UAAU;gBACrC,SAAS,EAAE,UAAU,CAAC,SAAS;gBAC/B,YAAY,EAAE,UAAU,CAAC,aAAa;gBACtC,UAAU,EAAE,GAAG,UAAU,CAAC,UAAU,IAAI,UAAU,CAAC,SAAS,EAAE;gBAC9D,YAAY,EAAE,UAAU,CAAC,aAAa;gBACtC,aAAa,EAAE,UAAU,CAAC,aAAa;aACxC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;IAE9B,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@se-studio/ab-testing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Server-side A/B testing framework for Next.js applications with Contentful CMS",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -64,14 +64,16 @@
|
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"next": ">=15.5.0 <16",
|
|
67
|
-
"react": "^19.0.0"
|
|
67
|
+
"react": "^19.0.0",
|
|
68
|
+
"@se-studio/core-ui": "1.9.0"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
71
|
"@biomejs/biome": "^2.5.0",
|
|
71
72
|
"@types/node": "^24.13.2",
|
|
72
73
|
"@types/react": "^19.2.17",
|
|
73
74
|
"next": "^15.5.19",
|
|
74
|
-
"typescript": "^6.0.3"
|
|
75
|
+
"typescript": "^6.0.3",
|
|
76
|
+
"@se-studio/core-ui": "1.9.0"
|
|
75
77
|
},
|
|
76
78
|
"scripts": {
|
|
77
79
|
"build": "tsc --project tsconfig.build.json",
|