@uxf/analytics 11.125.0 → 11.126.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.
Files changed (2) hide show
  1. package/README.md +31 -30
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # @uxf/analytics
2
+
2
3
  [![npm](https://img.shields.io/npm/v/@uxf/analytics)](https://www.npmjs.com/package/@uxf/analytics)
3
4
  [![size](https://img.shields.io/bundlephobia/min/@uxf/analytics)](https://www.npmjs.com/package/@uxf/analytics)
4
5
  [![quality](https://img.shields.io/npms-io/quality-score/@uxf/analytics)](https://www.npmjs.com/package/@uxf/analytics)
@@ -222,42 +223,42 @@ export default Page;
222
223
 
223
224
  ### `@uxf/analytics/consent`
224
225
 
225
- | Export | Signature | Description |
226
- | --- | --- | --- |
227
- | `storeConsentToCookie` | `(consent: CookiesConsentType, version: number, cookieTtl?: number) => void` | Writes the consent cookie (default TTL 90 days). Throws on the server. |
228
- | `readConsentFromCookie` | `(ctx?: AnyObject \| null) => CookieConsentTypeWithVersion` | Reads and decodes the consent cookie. Pass a request-like `ctx` to read server-side. |
229
- | `isConsentCookieSet` | `(ctx: AnyObject \| null, version: number) => boolean` | `true` when all four flags are set and the stored version matches. |
230
- | `CookiesConsentType` | `{ ad_personalization?, ad_storage?, ad_user_data?, analytics_storage?: boolean }` | The four Google consent flags. |
231
- | `CookieConsentTypeWithVersion` | `CookiesConsentType & { version: number }` | Shape stored in the cookie. |
226
+ | Export | Signature | Description |
227
+ | ------------------------------ | ---------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
228
+ | `storeConsentToCookie` | `(consent: CookiesConsentType, version: number, cookieTtl?: number) => void` | Writes the consent cookie (default TTL 90 days). Throws on the server. |
229
+ | `readConsentFromCookie` | `(ctx?: AnyObject \| null) => CookieConsentTypeWithVersion` | Reads and decodes the consent cookie. Pass a request-like `ctx` to read server-side. |
230
+ | `isConsentCookieSet` | `(ctx: AnyObject \| null, version: number) => boolean` | `true` when all four flags are set and the stored version matches. |
231
+ | `CookiesConsentType` | `{ ad_personalization?, ad_storage?, ad_user_data?, analytics_storage?: boolean }` | The four Google consent flags. |
232
+ | `CookieConsentTypeWithVersion` | `CookiesConsentType & { version: number }` | Shape stored in the cookie. |
232
233
 
233
234
  ### `@uxf/analytics/gtm`
234
235
 
235
- | Export | Signature | Description |
236
- | --- | --- | --- |
237
- | `useGtmScript` | `(gtmId: string) => string` | Builds the inline GTM bootstrap script (default consent from the cookie + container loader). |
238
- | `updateGtmConsent` | `(consent: CookiesConsentType, version: number) => void` | Stores consent and pushes gtag `consent: "update"` + `consent_resolved`. Client-only. |
239
- | `ConsentType` | `"granted" \| "denied"` | gtag consent value. |
240
- | `GtmConsentData` | type | gtag consent payload / event union. |
241
- | `GtmDataLayer` | `{ push: (gtmEventData: unknown) => void }` | `window.dataLayer` shape (augments `Window`). |
236
+ | Export | Signature | Description |
237
+ | ------------------ | -------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
238
+ | `useGtmScript` | `(gtmId: string) => string` | Builds the inline GTM bootstrap script (default consent from the cookie + container loader). |
239
+ | `updateGtmConsent` | `(consent: CookiesConsentType, version: number) => void` | Stores consent and pushes gtag `consent: "update"` + `consent_resolved`. Client-only. |
240
+ | `ConsentType` | `"granted" \| "denied"` | gtag consent value. |
241
+ | `GtmConsentData` | type | gtag consent payload / event union. |
242
+ | `GtmDataLayer` | `{ push: (gtmEventData: unknown) => void }` | `window.dataLayer` shape (augments `Window`). |
242
243
 
243
244
  ### `@uxf/analytics/ab-testing`
244
245
 
245
- | Export | Signature | Description |
246
- | --- | --- | --- |
247
- | `handleABTesting` | `(request, response, experiments: ExperimentConfig[], options?: { domain?: string }) => void` | Proxy/middleware: assigns and prunes experiment cookies. |
248
- | `getExperimentVariant` | `(config: ExperimentConfig, randomNumberForTesting?: number \| null) => ExperimentVariant \| null` | Picks a variant by weighted traffic; `null` = not participating. |
249
- | `getExperimentsFromContext` | `(cookies: Partial<{ [key: string]: string }>) => [string, string][]` | Extracts `[id, variant]` pairs from a server cookie map. |
250
- | `getExperimentsFromClient` | `() => [string, string][]` | Extracts `[id, variant]` pairs from `document.cookie`. |
251
- | `addExperimentsSSR` | `(ctx, pageProps) => pageProps` | Pages Router `getServerSideProps` helper; injects variants under `AB_TESTING_VARIANT_PROP_NAME`. |
252
- | `sendABTestingEvent` | `(getExpVariantString?: GetExpVariantString) => void` | Pushes an `experience_impression` GTM event per experiment cookie. Client-only. |
253
- | `ABTestingProvider` | `(props: { children; experiments: [string, string][]; getExpVariantString? }) => JSX` | Provides variants to the tree and fires `sendABTestingEvent` on mount. |
254
- | `useABTesting` | `() => [string, string][]` | Returns all `[id, variant]` pairs from context. |
255
- | `useABTestingVariant` | `<Config extends ExperimentConfig[]>(experimentId) => variantName \| null` | Returns the variant name for one experiment, or `null`. |
256
- | `AB_TESTING_VARIANT_PROP_NAME` | `"__AB_TESTING_VARIANT__"` | Page-prop key used by `addExperimentsSSR`. |
257
- | `EXPERIMENT_COOKIE_PREFIX` | `"uxf-experiment-"` | Prefix of every experiment cookie. |
258
- | `ExperimentVariant` | `{ name: string; traffic: number; label?: string }` | A single variant. |
259
- | `ExperimentConfig` | `{ id: string; traffic: number; variants: ExperimentVariant[] }` | One experiment. |
260
- | `GetExpVariantString` | `(cookie: { name: string; value: string }) => string` | Maps a cookie to the `exp_variant_string` sent to GTM. |
246
+ | Export | Signature | Description |
247
+ | ------------------------------ | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
248
+ | `handleABTesting` | `(request, response, experiments: ExperimentConfig[], options?: { domain?: string }) => void` | Proxy/middleware: assigns and prunes experiment cookies. |
249
+ | `getExperimentVariant` | `(config: ExperimentConfig, randomNumberForTesting?: number \| null) => ExperimentVariant \| null` | Picks a variant by weighted traffic; `null` = not participating. |
250
+ | `getExperimentsFromContext` | `(cookies: Partial<{ [key: string]: string }>) => [string, string][]` | Extracts `[id, variant]` pairs from a server cookie map. |
251
+ | `getExperimentsFromClient` | `() => [string, string][]` | Extracts `[id, variant]` pairs from `document.cookie`. |
252
+ | `addExperimentsSSR` | `(ctx, pageProps) => pageProps` | Pages Router `getServerSideProps` helper; injects variants under `AB_TESTING_VARIANT_PROP_NAME`. |
253
+ | `sendABTestingEvent` | `(getExpVariantString?: GetExpVariantString) => void` | Pushes an `experience_impression` GTM event per experiment cookie. Client-only. |
254
+ | `ABTestingProvider` | `(props: { children; experiments: [string, string][]; getExpVariantString? }) => JSX` | Provides variants to the tree and fires `sendABTestingEvent` on mount. |
255
+ | `useABTesting` | `() => [string, string][]` | Returns all `[id, variant]` pairs from context. |
256
+ | `useABTestingVariant` | `<Config extends ExperimentConfig[]>(experimentId) => variantName \| null` | Returns the variant name for one experiment, or `null`. |
257
+ | `AB_TESTING_VARIANT_PROP_NAME` | `"__AB_TESTING_VARIANT__"` | Page-prop key used by `addExperimentsSSR`. |
258
+ | `EXPERIMENT_COOKIE_PREFIX` | `"uxf-experiment-"` | Prefix of every experiment cookie. |
259
+ | `ExperimentVariant` | `{ name: string; traffic: number; label?: string }` | A single variant. |
260
+ | `ExperimentConfig` | `{ id: string; traffic: number; variants: ExperimentVariant[] }` | One experiment. |
261
+ | `GetExpVariantString` | `(cookie: { name: string; value: string }) => string` | Maps a cookie to the `exp_variant_string` sent to GTM. |
261
262
 
262
263
  ## Gotchas
263
264
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/analytics",
3
- "version": "11.125.0",
3
+ "version": "11.126.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build": "tsc -P tsconfig.json",
@@ -15,14 +15,14 @@
15
15
  "author": "",
16
16
  "license": "ISC",
17
17
  "peerDependencies": {
18
- "@uxf/core": "11.124.0",
19
- "@uxf/core-react": "11.125.0",
18
+ "@uxf/core": "11.126.0",
19
+ "@uxf/core-react": "11.126.0",
20
20
  "react": ">=18.0.2"
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/react": "18.3.31",
24
- "@uxf/core": "11.124.0",
25
- "@uxf/core-react": "11.125.0",
24
+ "@uxf/core": "11.126.0",
25
+ "@uxf/core-react": "11.126.0",
26
26
  "react": "18.3.1"
27
27
  }
28
28
  }