@beworke/pixel 0.1.0-rc.5 → 0.1.0-rc.7
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 +38 -69
- package/RELEASE_CANDIDATE.md +19 -13
- package/dist/{StorageFactory-CPghDPBj.d.mts → StorageFactory-Cq29vF32.d.mts} +2 -2
- package/dist/{StorageFactory-tjfzk57c.d.ts → StorageFactory-DeMaZ8wk.d.ts} +2 -2
- package/dist/config/index.cjs.js +1 -1
- package/dist/config/index.cjs.js.map +1 -1
- package/dist/config/index.d.mts +4 -4
- package/dist/config/index.d.ts +4 -4
- package/dist/config/index.esm.js +1 -1
- package/dist/config/index.esm.js.map +1 -1
- package/dist/events/index.cjs.js.map +1 -1
- package/dist/events/index.d.mts +2 -2
- package/dist/events/index.d.ts +2 -2
- package/dist/events/index.esm.js.map +1 -1
- package/dist/examples/html-script/README.md +20 -76
- package/dist/examples/html-script/RELEASE_CANDIDATE.md +14 -13
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-autocomplete.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-disabled.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-card-fields.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-data-track.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-dedupe.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-manual.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-rules-card.html +1 -1
- package/dist/examples/html-script/add-payment-info/example-add-payment-info-security.html +1 -1
- package/dist/examples/html-script/add-to-cart/README.md +6 -3
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-attribute.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-auto.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-click.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-dedupe.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-link.html +597 -0
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-manual.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-order-bump.html +3 -2
- package/dist/examples/html-script/add-to-cart/example-add-to-cart-text.html +3 -2
- package/dist/examples/html-script/behavior/example-behavior-engagement.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-heartbeat.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-runtime-intelligence.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior-viewport.html +1 -1
- package/dist/examples/html-script/behavior/example-behavior.html +1 -1
- package/dist/examples/html-script/example-basic.html +1 -1
- package/dist/examples/html-script/example-checkout-commerce.html +1 -1
- package/dist/examples/html-script/example-conversion.html +1 -1
- package/dist/examples/html-script/example-integration.html +1 -1
- package/dist/examples/html-script/example-landing-commerce.html +42 -1
- package/dist/examples/html-script/example-runtime-diagnostics.html +1 -1
- package/dist/examples/html-script/example-transport.html +6 -1
- package/dist/examples/html-script/full-funnel/README.md +1 -1
- package/dist/examples/html-script/full-funnel/checkout.html +1 -1
- package/dist/examples/html-script/full-funnel/downsell.html +1 -1
- package/dist/examples/html-script/full-funnel/landing.html +54 -2
- package/dist/examples/html-script/full-funnel/thank-you.html +1 -1
- package/dist/examples/html-script/full-funnel/upsell.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-attribute.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-auto.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-click.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-manual.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-snapshot.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-submit.html +1 -1
- package/dist/examples/html-script/initiate-checkout/example-initiate-checkout-text.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-attribute.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-auto.html +1 -1
- package/dist/examples/html-script/lead/example-lead-trigger-click.html +1 -1
- package/dist/examples/html-script/release-candidate.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-attribute.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-css.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-dedupe.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-manual.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-multi.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-state.html +1 -1
- package/dist/examples/html-script/remove-from-cart/example-remove-from-cart-text.html +1 -1
- package/dist/examples/html-script/search/example-search-attribute.html +1 -1
- package/dist/examples/html-script/search/example-search-button-sync.html +1 -1
- package/dist/examples/html-script/search/example-search-dedupe.html +1 -1
- package/dist/examples/html-script/search/example-search-input.html +1 -1
- package/dist/examples/html-script/search/example-search-manual.html +1 -1
- package/dist/examples/html-script/search/example-search-submit.html +1 -1
- package/dist/examples/html-script/search/example-search-text.html +1 -1
- package/dist/examples/html-script/url-context/example-url-context-allowed-domains.html +38 -9
- package/dist/examples/html-script/url-context/example-url-context-landing.html +53 -13
- package/dist/examples/html-script/url-context/example-url-context-upsell.html +48 -10
- package/dist/examples/html-script/url-context/example-url-context.html +51 -17
- package/dist/examples/html-script/view-content/example-view-content-attribute.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-css.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-dedupe.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-empty.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-manual.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-product-card.html +1 -1
- package/dist/examples/html-script/view-content/example-view-content-text.html +1 -1
- package/dist/examples/release-candidate/README.md +2 -1
- package/dist/examples/v2/README.md +15 -15
- package/dist/{index-CQAyT5Od.d.ts → index-B8u_3PGG.d.ts} +21 -2
- package/dist/{index-JlKPz4pp.d.mts → index-BxT2d-TK.d.mts} +21 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +19 -782
- package/dist/index.d.ts +19 -782
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/{pixel-BxZZx8l5.d.ts → pixel-2uL4LSyC.d.ts} +126 -5
- package/dist/{pixel-CKc4OQUx.d.mts → pixel-DMwpppf_.d.mts} +126 -5
- package/dist/{pixel-default-config-aAOujzwp.d.ts → pixel-default-config-BDPUVHse.d.ts} +1 -1
- package/dist/{pixel-default-config-CJl-eypl.d.mts → pixel-default-config-C5uLt52W.d.mts} +1 -1
- package/dist/runtime/index.cjs.js +1 -1
- package/dist/runtime/index.cjs.js.map +1 -1
- package/dist/runtime/index.d.mts +6 -6
- package/dist/runtime/index.d.ts +6 -6
- package/dist/runtime/index.esm.js +1 -1
- package/dist/runtime/index.esm.js.map +1 -1
- package/dist/services/index.cjs.js +1 -1
- package/dist/services/index.cjs.js.map +1 -1
- package/dist/services/index.d.mts +7 -7
- package/dist/services/index.d.ts +7 -7
- package/dist/services/index.esm.js +1 -1
- package/dist/services/index.esm.js.map +1 -1
- package/dist/{types-BP8dz1gP.d.mts → types-6HF3UlsL.d.mts} +2 -2
- package/dist/{types-C75pQP31.d.ts → types-BqUEoZo0.d.ts} +2 -2
- package/dist/{types-DMhzHSVC.d.mts → types-CgrabttM.d.mts} +2 -2
- package/dist/{types-D_SsCur9.d.ts → types-fFcQ1apy.d.ts} +2 -2
- package/dist/{url-context-BjAsQoVl.d.mts → url-context-Ck2LK18V.d.mts} +4 -2
- package/dist/{url-context-BjAsQoVl.d.ts → url-context-Ck2LK18V.d.ts} +4 -2
- package/dist/v2/global.global.js +1 -1
- package/dist/v2/global.global.js.map +1 -1
- package/dist/v2/index.cjs.js +1 -1
- package/dist/v2/index.cjs.js.map +1 -1
- package/dist/v2/index.d.mts +793 -9
- package/dist/v2/index.d.ts +793 -9
- package/dist/v2/index.esm.js +1 -1
- package/dist/v2/index.esm.js.map +1 -1
- package/docs/public/README.md +77 -0
- package/docs/public/api/exports.md +47 -0
- package/docs/public/api/pixel.md +65 -0
- package/docs/public/configuration/commerce.md +44 -0
- package/docs/public/configuration/modules.md +66 -0
- package/docs/public/configuration/overview.md +66 -0
- package/docs/public/events/catalog.md +65 -0
- package/docs/public/getting-started/installation.md +78 -0
- package/docs/public/getting-started/quick-start.md +77 -0
- package/docs/public/getting-started/react-nextjs.md +55 -0
- package/docs/public/getting-started/script-tag.md +57 -0
- package/docs/public/guides/funnel-checkout.md +52 -0
- package/docs/public/guides/funnel-downsell.md +53 -0
- package/docs/public/guides/funnel-full.md +64 -0
- package/docs/public/guides/funnel-landing.md +68 -0
- package/docs/public/guides/funnel-thank-you.md +48 -0
- package/docs/public/guides/funnel-upsell.md +72 -0
- package/docs/public/limitations.md +32 -0
- package/docs/public/privacy/limitations.md +33 -0
- package/docs/public/release-candidate/validation.md +42 -0
- package/docs/public/troubleshooting.md +55 -0
- package/package.json +10 -13
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Pixel v2 — Documentação pública (RC)
|
|
2
|
+
|
|
3
|
+
Documentação para desenvolvedores que implementam funis e páginas com `@beworke/pixel`.
|
|
4
|
+
|
|
5
|
+
**Versão de referência:** `0.1.0-rc.6` · **Etapas concluídas:** 1–20
|
|
6
|
+
|
|
7
|
+
> Esta pasta é a documentação **pública**. Arquitetura interna, prompts de etapas e relatórios de engenharia ficam em `PLAN_PIXEL/` (`ARCHITECTURE.md`, `PIXEL_V2_*`).
|
|
8
|
+
|
|
9
|
+
## Onde ler (importante)
|
|
10
|
+
|
|
11
|
+
| Contexto | URL / caminho |
|
|
12
|
+
|----------|----------------|
|
|
13
|
+
| **GitHub (browser)** | https://github.com/techionext/Pixel-Global/tree/main/packages/pixel/docs/public |
|
|
14
|
+
| **Pacote npm instalado** | `node_modules/@beworke/pixel/docs/public/` |
|
|
15
|
+
| **npmjs.com** | Só renderiza o `README.md` do pacote — **não** abre `.md` individuais |
|
|
16
|
+
|
|
17
|
+
Instalação: `npm install @beworke/pixel@rc` (público, sem token).
|
|
18
|
+
|
|
19
|
+
## Começar
|
|
20
|
+
|
|
21
|
+
| Guia | Descrição |
|
|
22
|
+
|------|-----------|
|
|
23
|
+
| [Instalação](./getting-started/installation.md) | npm, tarball local, validação do pacote |
|
|
24
|
+
| [Quick start](./getting-started/quick-start.md) | Primeiro `init` em ESM/CJS |
|
|
25
|
+
| [Script tag (IIFE)](./getting-started/script-tag.md) | `@beworke/pixel/global` → `window.PixelV2` |
|
|
26
|
+
| [React / Next.js](./getting-started/react-nextjs.md) | Padrão `useEffect` + hooks locais |
|
|
27
|
+
|
|
28
|
+
## Referência
|
|
29
|
+
|
|
30
|
+
| Documento | Conteúdo |
|
|
31
|
+
|-----------|----------|
|
|
32
|
+
| [API — Pixel](./api/pixel.md) | Métodos públicos estáveis |
|
|
33
|
+
| [Package exports](./api/exports.md) | Subpaths do `package.json` |
|
|
34
|
+
| [Catálogo de eventos](./events/catalog.md) | Tipos `PixelEvent` por categoria |
|
|
35
|
+
| [Configuração — visão geral](./configuration/overview.md) | `PixelConfig` e defaults |
|
|
36
|
+
| [Módulos](./configuration/modules.md) | `modules.core`, `behavior`, `conversion`, etc. |
|
|
37
|
+
| [Commerce (root)](./configuration/commerce.md) | `commerce.catalog`, `cart`, `enrichment` |
|
|
38
|
+
|
|
39
|
+
## Funis
|
|
40
|
+
|
|
41
|
+
| Página | Guia |
|
|
42
|
+
|--------|------|
|
|
43
|
+
| Landing | [guides/funnel-landing.md](./guides/funnel-landing.md) |
|
|
44
|
+
| Checkout | [guides/funnel-checkout.md](./guides/funnel-checkout.md) |
|
|
45
|
+
| Upsell | [guides/funnel-upsell.md](./guides/funnel-upsell.md) |
|
|
46
|
+
| Downsell | [guides/funnel-downsell.md](./guides/funnel-downsell.md) |
|
|
47
|
+
| Thank-you | [guides/funnel-thank-you.md](./guides/funnel-thank-you.md) |
|
|
48
|
+
| Funil completo | [guides/funnel-full.md](./guides/funnel-full.md) |
|
|
49
|
+
|
|
50
|
+
## Exemplos públicos
|
|
51
|
+
|
|
52
|
+
Exemplos em `apps/playground-html/public/` usam **somente API pública** (sem `getDebugServices`, sem hooks de debug).
|
|
53
|
+
|
|
54
|
+
| Exemplo | Caminho no monorepo |
|
|
55
|
+
|---------|---------------------|
|
|
56
|
+
| Landing (HTML) | `apps/playground-html/public/html/landing.html` |
|
|
57
|
+
| Checkout (HTML) | `apps/playground-html/public/html/checkout.html` |
|
|
58
|
+
| Next.js (App Router) | `apps/playground-next/` (hooks locais, não exportados pelo SDK) |
|
|
59
|
+
|
|
60
|
+
Playgrounds internos de engenharia: `apps/playground-html/` (podem usar APIs `@internal`).
|
|
61
|
+
|
|
62
|
+
> **Legado:** na estrutura anterior ao monorepo, estes caminhos eram `examples/public/`, `examples/nextjs/` e `examples/html-script/`.
|
|
63
|
+
|
|
64
|
+
## Privacidade e limitações
|
|
65
|
+
|
|
66
|
+
| Documento | Conteúdo |
|
|
67
|
+
|-----------|----------|
|
|
68
|
+
| [Privacidade e consentimento](./privacy/limitations.md) | RC sem CMP completo; responsabilidade da aplicação |
|
|
69
|
+
| [Limitações conhecidas do RC](./limitations.md) | O que não está pronto para produção pública |
|
|
70
|
+
| [Troubleshooting](./troubleshooting.md) | Erros comuns |
|
|
71
|
+
|
|
72
|
+
## Release Candidate
|
|
73
|
+
|
|
74
|
+
| Documento | Conteúdo |
|
|
75
|
+
|-----------|----------|
|
|
76
|
+
| [Validação do pacote](./release-candidate/validation.md) | `pack:pixel`, smoke, checklist |
|
|
77
|
+
| [RELEASE_CANDIDATE.md](../../RELEASE_CANDIDATE.md) | Notas oficiais do RC |
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Package exports
|
|
2
|
+
|
|
3
|
+
Auditado contra `package.json` do RC `0.1.0-rc.5`.
|
|
4
|
+
|
|
5
|
+
## Entry principal
|
|
6
|
+
|
|
7
|
+
| Subpath | Import | Conteúdo principal |
|
|
8
|
+
|---------|--------|-------------------|
|
|
9
|
+
| `@beworke/pixel` | ESM / CJS | `Pixel`, `DEFAULT_PIXEL_CONFIG`, `PixelConfig`, `PixelDebugSnapshot`, `resolveStorageAdapterName` |
|
|
10
|
+
| `@beworke/pixel/v2` | ESM / CJS | Alias do entry principal (mesmos exports) |
|
|
11
|
+
|
|
12
|
+
## Global (IIFE)
|
|
13
|
+
|
|
14
|
+
| Subpath | Formato | Global |
|
|
15
|
+
|---------|---------|--------|
|
|
16
|
+
| `@beworke/pixel/global` | IIFE | `window.PixelV2` |
|
|
17
|
+
|
|
18
|
+
Arquivo build: `dist/v2/global.global.js`
|
|
19
|
+
|
|
20
|
+
## Subpaths avançados
|
|
21
|
+
|
|
22
|
+
Úteis para tipos, eventos ou integrações custom — **não** necessários para funis básicos.
|
|
23
|
+
|
|
24
|
+
| Subpath | Uso típico |
|
|
25
|
+
|---------|------------|
|
|
26
|
+
| `@beworke/pixel/config` | Tipos e helpers de config |
|
|
27
|
+
| `@beworke/pixel/events` | Tipos `PixelEvent`, payloads de conversão |
|
|
28
|
+
| `@beworke/pixel/runtime` | Runtime interno (uso avançado) |
|
|
29
|
+
| `@beworke/pixel/services` | Serviços compartilhados |
|
|
30
|
+
| `@beworke/pixel/logger` | Logger do SDK |
|
|
31
|
+
|
|
32
|
+
## Não exportado
|
|
33
|
+
|
|
34
|
+
| Subpath | Status |
|
|
35
|
+
|---------|--------|
|
|
36
|
+
| `@beworke/pixel/diagnostics` | **Não existe** no `package.json` RC |
|
|
37
|
+
|
|
38
|
+
`PixelDebugSnapshot` é exportado pelo entry principal, não por subpath separado.
|
|
39
|
+
|
|
40
|
+
## Validar tarball
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm pack --dry-run
|
|
44
|
+
npm run validate:rc-package
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Arquivos publicados (`files`): `dist/`, `README.md`, `CHANGELOG.md`, `RELEASE_CANDIDATE.md`.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# API — classe `Pixel`
|
|
2
|
+
|
|
3
|
+
Superfície pública estável do RC `0.1.0-rc.5`. Métodos marcados `@internal` no código **não** fazem parte desta referência.
|
|
4
|
+
|
|
5
|
+
## Construtor
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { Pixel, type PixelConfig } from '@beworke/pixel';
|
|
9
|
+
|
|
10
|
+
const pixel = new Pixel(config);
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Ciclo de vida
|
|
14
|
+
|
|
15
|
+
| Método | Retorno | Descrição |
|
|
16
|
+
|--------|---------|-----------|
|
|
17
|
+
| `init()` | `Promise<void>` | Inicializa runtime, módulos e emite `PAGE_VIEW` quando core habilitado |
|
|
18
|
+
| `destroy()` | `Promise<void>` | Remove listeners, flush parcial e marca snapshot como destruído |
|
|
19
|
+
| `isInitialized()` | `boolean` | `true` após `init()` concluir com sucesso |
|
|
20
|
+
|
|
21
|
+
## Diagnóstico (público)
|
|
22
|
+
|
|
23
|
+
| Método | Retorno | Descrição |
|
|
24
|
+
|--------|---------|-----------|
|
|
25
|
+
| `getDebugSnapshot()` | `Readonly<PixelDebugSnapshot>` | Snapshot read-only sanitizado; seguro antes/depois de init e após destroy |
|
|
26
|
+
|
|
27
|
+
Use em desenvolvimento para validar sessão, fila de transport e módulos. Não substitui observabilidade de produção.
|
|
28
|
+
|
|
29
|
+
## Conversão (manual)
|
|
30
|
+
|
|
31
|
+
Todos retornam `void`. Dados opcionais enriquecem payload; commerce config pode calcular `value`/`items`.
|
|
32
|
+
|
|
33
|
+
| Método | Dados | Evento emitido |
|
|
34
|
+
|--------|-------|----------------|
|
|
35
|
+
| `purchase(data?)` | `PurchaseData` | `PURCHASE` |
|
|
36
|
+
| `lead(data)` | `LeadData` (obrigatório) | `LEAD` |
|
|
37
|
+
| `addToCart(data?)` | `AddToCartData` | `ADD_TO_CART` |
|
|
38
|
+
| `removeFromCart(data?)` | `RemoveFromCartData` | `REMOVE_FROM_CART` |
|
|
39
|
+
| `initiateCheckout(data?)` | `InitiateCheckoutData` | `INITIATE_CHECKOUT` |
|
|
40
|
+
| `addPaymentInfo(data?)` | `AddPaymentInfoEvent` | `ADD_PAYMENT_INFO` |
|
|
41
|
+
| `viewContent(data?)` | `ViewContentData` | `VIEW_CONTENT` |
|
|
42
|
+
| `search(data)` | `SearchData` (obrigatório) | `SEARCH` |
|
|
43
|
+
|
|
44
|
+
Tipos de dados: importe de `@beworke/pixel/events` se necessário.
|
|
45
|
+
|
|
46
|
+
## Exports relacionados (entry principal)
|
|
47
|
+
|
|
48
|
+
| Export | Uso |
|
|
49
|
+
|--------|-----|
|
|
50
|
+
| `DEFAULT_PIXEL_CONFIG` | Defaults auditados — base para merge |
|
|
51
|
+
| `PixelConfig` | Tipo da configuração |
|
|
52
|
+
| `PixelDebugSnapshot` | Tipo do snapshot |
|
|
53
|
+
| `resolveStorageAdapterName` | Resolve nome do adapter de persistência |
|
|
54
|
+
|
|
55
|
+
## Não usar em produção / exemplos públicos
|
|
56
|
+
|
|
57
|
+
Estes existem no código para playgrounds internos:
|
|
58
|
+
|
|
59
|
+
- `getDebugServices()`
|
|
60
|
+
- `debugPublishBehaviorSignal()`
|
|
61
|
+
- `flushBehaviorBuffer()`
|
|
62
|
+
- `simulateTransport*`, `manualTransportReplay`, etc.
|
|
63
|
+
- `getDebugDedupeKeys`, `getDebugIntegrationState`, …
|
|
64
|
+
|
|
65
|
+
Veja `apps/playground-html/` apenas para engenharia interna.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Commerce (`commerce`)
|
|
2
|
+
|
|
3
|
+
Configuração root-level (não dentro de `modules`).
|
|
4
|
+
|
|
5
|
+
## Campos principais
|
|
6
|
+
|
|
7
|
+
| Campo | Default | Descrição |
|
|
8
|
+
|-------|---------|-----------|
|
|
9
|
+
| `enabled` | `false` (via shared default) | Habilita enrichment commerce |
|
|
10
|
+
| `currency` | conforme `DEFAULT_COMMERCE_CONFIG` | Moeda padrão |
|
|
11
|
+
| `catalog.products` | `[]` | Produtos da oferta (main, bump, upsell) |
|
|
12
|
+
| `cart.mode` | `'custom'` | Carrinho gerenciado pelo app |
|
|
13
|
+
| `cart.allowDynamicItems` | `true` | Itens dinâmicos no carrinho |
|
|
14
|
+
| `cart.calculateValueFrom` | `'cart'` | Cálculo de `value` |
|
|
15
|
+
| `mappings` | `{}` | Mapeamento de atributos/campos |
|
|
16
|
+
| `enrichment` | defaults | Enriquece payloads de conversão |
|
|
17
|
+
|
|
18
|
+
## Quando usar
|
|
19
|
+
|
|
20
|
+
- **Checkout:** catálogo com produto principal + order bumps
|
|
21
|
+
- **Upsell/downsell:** produtos adicionais no `catalog`; dispare `viewContent` / `purchase` manualmente
|
|
22
|
+
- **Thank-you:** `purchase` com `transactionId` do pedido
|
|
23
|
+
|
|
24
|
+
## Exemplo (checkout)
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
commerce: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
currency: 'BRL',
|
|
30
|
+
catalog: {
|
|
31
|
+
products: [
|
|
32
|
+
{ id: 'main', name: 'Oferta', type: 'main', price: 197, currency: 'BRL', quantity: 1 },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
cart: {
|
|
36
|
+
mode: 'custom',
|
|
37
|
+
initialItems: [],
|
|
38
|
+
allowDynamicItems: true,
|
|
39
|
+
calculateValueFrom: 'cart',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Referência completa: `apps/playground-next/lib/pixel-config.ts`.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Módulos (`modules.*`)
|
|
2
|
+
|
|
3
|
+
Referência resumida auditada contra `DEFAULT_PIXEL_CONFIG`.
|
|
4
|
+
|
|
5
|
+
## `modules.core`
|
|
6
|
+
|
|
7
|
+
| Campo | Default | Descrição |
|
|
8
|
+
|-------|---------|-----------|
|
|
9
|
+
| `enabled` | `true` | Módulo core ativo |
|
|
10
|
+
| `pageView.enabled` | `true` | Emite `PAGE_VIEW` |
|
|
11
|
+
| `pageView.trackInitialPageView` | `true` | No `init()` |
|
|
12
|
+
| `pageView.spa` | `true` | Suporte SPA |
|
|
13
|
+
| `visitor.enabled` | `true` | Gera/persiste visitor |
|
|
14
|
+
| `session.enabled` | `true` | Sessão com TTL 3h |
|
|
15
|
+
| `consent.enabled` | `false` | Gate de consentimento **off** no default |
|
|
16
|
+
|
|
17
|
+
**Quando usar:** sempre em páginas web. Desligue apenas em testes headless sem DOM.
|
|
18
|
+
|
|
19
|
+
## `modules.behavior`
|
|
20
|
+
|
|
21
|
+
| Campo | Default | Descrição |
|
|
22
|
+
|-------|---------|-----------|
|
|
23
|
+
| `enabled` | `false` | Behavior off por default |
|
|
24
|
+
| `trackers.scroll/click/...` | `enabled: false` | Habilitar por tracker |
|
|
25
|
+
| `heartbeat.enabled` | `false` | `BEHAVIOR_HEARTBEAT` |
|
|
26
|
+
| `engagement.enabled` | `false` | Score + `ENGAGEMENT_*` |
|
|
27
|
+
| `rateLimit/buffer/stateMachine/sessionSummary` | `enabled: false` | Runtime intelligence (Etapa 20) |
|
|
28
|
+
|
|
29
|
+
**Quando usar:** landing e páginas de conteúdo para scroll, cliques, engagement.
|
|
30
|
+
|
|
31
|
+
**Limitação RC:** muitos sub-recursos exigem config explícita; defaults conservadores.
|
|
32
|
+
|
|
33
|
+
## `modules.conversion`
|
|
34
|
+
|
|
35
|
+
| Campo | Default | Descrição |
|
|
36
|
+
|-------|---------|-----------|
|
|
37
|
+
| `enabled` | `false` | Flag do módulo |
|
|
38
|
+
| `manual.*` | `enabled: false` | Wrappers manuais internos |
|
|
39
|
+
| `auto.enabled` | `false` | AutoTrack off |
|
|
40
|
+
| `rules.enabled` | `false` | Regras por seletor/URL |
|
|
41
|
+
|
|
42
|
+
**Quando usar:** habilite `auto` + detectors para AutoTrack; ou use API `pixel.purchase()` etc. sem auto.
|
|
43
|
+
|
|
44
|
+
## `modules.transport`
|
|
45
|
+
|
|
46
|
+
| Campo | Default | Descrição |
|
|
47
|
+
|-------|---------|-----------|
|
|
48
|
+
| `enabled` | `false` | **Deve ser `true` + `sender.mode: 'api'` para API real** |
|
|
49
|
+
| `sender.mode` | `'mock'` | RC local usa mock até configurar API |
|
|
50
|
+
| `batch.enabled` | `true` | Agrupa envios |
|
|
51
|
+
| `retry`, `circuitBreaker`, `offline` | habilitados | Resiliência |
|
|
52
|
+
|
|
53
|
+
**Quando usar:** produção/staging com `transport.apiEndpoint` e `sender.mode: 'api'`.
|
|
54
|
+
|
|
55
|
+
## `modules.integrations`
|
|
56
|
+
|
|
57
|
+
Destinos browser (GA, Meta, etc.) — ver defaults em `@beworke/pixel/config`. Off por default no RC de funil API-first.
|
|
58
|
+
|
|
59
|
+
## `modules.privacy`
|
|
60
|
+
|
|
61
|
+
| Campo | Default | Descrição |
|
|
62
|
+
|-------|---------|-----------|
|
|
63
|
+
| `enabled` | `false` | Módulo privacy off |
|
|
64
|
+
| `consent.enabled` | `false` | Sem CMP integrado |
|
|
65
|
+
|
|
66
|
+
**Limitação RC:** consentimento completo previsto para Etapa 25. Ver [privacidade](../privacy/limitations.md).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Configuração — visão geral
|
|
2
|
+
|
|
3
|
+
`PixelConfig` é o objeto passado ao construtor `new Pixel(config)`.
|
|
4
|
+
|
|
5
|
+
Use `DEFAULT_PIXEL_CONFIG` como base e sobrescreva apenas o necessário.
|
|
6
|
+
|
|
7
|
+
## Top-level
|
|
8
|
+
|
|
9
|
+
| Seção | Descrição |
|
|
10
|
+
|-------|-----------|
|
|
11
|
+
| `app` | Ambiente, debug, source/target |
|
|
12
|
+
| `identity` | `pixelId`, IDs de funil, visitor, user |
|
|
13
|
+
| `transport` | API endpoint, batch, timeout, retry |
|
|
14
|
+
| `storage` | Prefixo, namespace, fila, persistência |
|
|
15
|
+
| `attribution` | UTM, cookies, persistência de atribuição |
|
|
16
|
+
| `commerce` | Catálogo, carrinho, enrichment |
|
|
17
|
+
| `modules` | Feature flags por módulo |
|
|
18
|
+
|
|
19
|
+
## Defaults críticos (`DEFAULT_PIXEL_CONFIG`)
|
|
20
|
+
|
|
21
|
+
| Campo | Default | Nota |
|
|
22
|
+
|-------|---------|------|
|
|
23
|
+
| `app.environment` | `'production'` | Use `'development'` + `debug: true` localmente |
|
|
24
|
+
| `app.debug` | `false` | |
|
|
25
|
+
| `identity.pixelId` | `''` | **Obrigatório** em produção |
|
|
26
|
+
| `transport.apiEndpoint` | `''` | **Obrigatório** para enviar eventos |
|
|
27
|
+
| `transport.timeoutMs` | `10000` | |
|
|
28
|
+
| `storage.prefix` | `'__gmk'` | |
|
|
29
|
+
| `storage.namespace` | `'pixel'` | |
|
|
30
|
+
| `storage.queue.enabled` | `true` | |
|
|
31
|
+
| `storage.queue.persistence` | `'memory'` | |
|
|
32
|
+
| `commerce.cart.mode` | `'custom'` | |
|
|
33
|
+
| `modules.core.enabled` | ver [modules](./modules.md) | Emite `PAGE_VIEW` |
|
|
34
|
+
| `modules.behavior.enabled` | `false` | Trackers off por default |
|
|
35
|
+
| `modules.conversion.enabled` | `false` | Manual API ainda funciona quando módulo registrado |
|
|
36
|
+
| `modules.transport.enabled` | ver modules | |
|
|
37
|
+
| `modules.privacy.enabled` | ver modules | Sem CMP completo no RC |
|
|
38
|
+
|
|
39
|
+
## Persistência recomendada (funis)
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
storage: {
|
|
43
|
+
...DEFAULT_PIXEL_CONFIG.storage,
|
|
44
|
+
persistence: {
|
|
45
|
+
visitor: 'localStorage',
|
|
46
|
+
session: 'sessionStorage',
|
|
47
|
+
attribution: 'localStorage',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Sem `persistence.session`, a sessão usa `memory` e some em reload/destroy React.
|
|
53
|
+
|
|
54
|
+
## Identity para funis
|
|
55
|
+
|
|
56
|
+
Campos úteis em `identity`:
|
|
57
|
+
|
|
58
|
+
- `pixelId` — ID do pixel na API
|
|
59
|
+
- `funnelId`, `funnelStepId` — etapa do funil
|
|
60
|
+
- `pageId`, `offerId`, `checkoutId`
|
|
61
|
+
- `visitorId`, `userId` — opcionais se gerenciados pelo backend
|
|
62
|
+
|
|
63
|
+
## Próximo
|
|
64
|
+
|
|
65
|
+
- [Módulos](./modules.md)
|
|
66
|
+
- [Commerce](./commerce.md)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Catálogo de eventos
|
|
2
|
+
|
|
3
|
+
Fonte: union `PixelEvent` (`src/events/types.ts`) — **24 tipos** no RC.
|
|
4
|
+
|
|
5
|
+
Todos os eventos listados abaixo passam pelo pipeline de transport quando `modules.transport.enabled` e `transport.apiEndpoint` estão configurados.
|
|
6
|
+
|
|
7
|
+
> `ApiEventType` (HTTP) inclui tipos legados/históricos que **não** fazem parte de `PixelEvent`. Use esta tabela como catálogo público.
|
|
8
|
+
|
|
9
|
+
## Core
|
|
10
|
+
|
|
11
|
+
| Tipo | Disparo | Transport |
|
|
12
|
+
|------|---------|-----------|
|
|
13
|
+
| `PAGE_VIEW` | Automático no `init()` (core habilitado) | Sim |
|
|
14
|
+
|
|
15
|
+
## Session
|
|
16
|
+
|
|
17
|
+
| Tipo | Disparo | Transport |
|
|
18
|
+
|------|---------|-----------|
|
|
19
|
+
| `SESSION_RENEWED` | Renovação de sessão | Sim |
|
|
20
|
+
| `SESSION_EXPIRED` | Expiração de sessão | Sim |
|
|
21
|
+
|
|
22
|
+
## Behavior
|
|
23
|
+
|
|
24
|
+
Requer `modules.behavior.enabled` e trackers/config correspondentes.
|
|
25
|
+
|
|
26
|
+
| Tipo | Disparo típico | Transport |
|
|
27
|
+
|------|----------------|-----------|
|
|
28
|
+
| `SCROLL` | Thresholds de scroll | Sim |
|
|
29
|
+
| `PAGE_CLICK` | Clique na página | Sim |
|
|
30
|
+
| `RAGE_CLICK` | Cliques repetidos (rage detector) | Sim |
|
|
31
|
+
| `VISIBILITY_CHANGE` | Tab hidden/visible | Sim |
|
|
32
|
+
| `USER_IDLE` | Usuário inativo | Sim |
|
|
33
|
+
| `USER_ACTIVE` | Retorno da inatividade | Sim |
|
|
34
|
+
| `EXIT_INTENT` | Intenção de saída | Sim |
|
|
35
|
+
| `BEHAVIOR_HEARTBEAT` | Intervalo configurado | Sim |
|
|
36
|
+
| `VIEWPORT_ENTER` | Elemento entra no viewport | Sim |
|
|
37
|
+
| `VIEWPORT_EXIT` | Elemento sai do viewport | Sim |
|
|
38
|
+
| `ENGAGEMENT_UPDATE` | Score de engagement muda | Sim |
|
|
39
|
+
| `ENGAGEMENT_SUMMARY` | Resumo (ex.: destroy) | Sim |
|
|
40
|
+
| `BEHAVIOR_SESSION_SUMMARY` | Resumo agregado da sessão (Etapa 20) | Sim |
|
|
41
|
+
|
|
42
|
+
## Conversion
|
|
43
|
+
|
|
44
|
+
Disparados por métodos públicos `pixel.*` ou auto-detectors quando habilitados.
|
|
45
|
+
|
|
46
|
+
| Tipo | API manual | Transport |
|
|
47
|
+
|------|------------|-----------|
|
|
48
|
+
| `PURCHASE` | `purchase()` | Sim |
|
|
49
|
+
| `LEAD` | `lead()` | Sim |
|
|
50
|
+
| `ADD_TO_CART` | `addToCart()` | Sim |
|
|
51
|
+
| `REMOVE_FROM_CART` | `removeFromCart()` | Sim |
|
|
52
|
+
| `INITIATE_CHECKOUT` | `initiateCheckout()` | Sim |
|
|
53
|
+
| `ADD_PAYMENT_INFO` | `addPaymentInfo()` | Sim |
|
|
54
|
+
| `VIEW_CONTENT` | `viewContent()` | Sim |
|
|
55
|
+
| `SEARCH` | `search()` | Sim |
|
|
56
|
+
|
|
57
|
+
## Eventos inexistentes (RC)
|
|
58
|
+
|
|
59
|
+
Não há tipos dedicados `UPSELL_*` ou `DOWNSELL_*`. Use `VIEW_CONTENT`, `PAGE_VIEW` e conversões commerce (`PURCHASE`, etc.) conforme [guias de funil](../guides/funnel-upsell.md).
|
|
60
|
+
|
|
61
|
+
## Importar tipos
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import type { PixelEvent, PurchaseEvent } from '@beworke/pixel/events';
|
|
65
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Instalação
|
|
2
|
+
|
|
3
|
+
## Requisitos
|
|
4
|
+
|
|
5
|
+
- Node.js 18+ (para npm/ESM)
|
|
6
|
+
- Navegador moderno (Chrome, Firefox, Safari, Edge)
|
|
7
|
+
|
|
8
|
+
## npm (registry — recomendado para o time)
|
|
9
|
+
|
|
10
|
+
Pacote **público** — **não precisa de token** nem login npm para instalar:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @beworke/pixel@rc
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Versão fixa:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @beworke/pixel@0.1.0-rc.6
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Confirme a versão instalada:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
node -e "console.log(require('@beworke/pixel/package.json').version)"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> Evite `npm install @beworke/pixel` sem tag até a tag `latest` apontar para a RC atual. Use `@rc` ou `@0.1.0-rc.6`.
|
|
29
|
+
|
|
30
|
+
## Onde ler a documentação
|
|
31
|
+
|
|
32
|
+
| Contexto | Caminho |
|
|
33
|
+
|----------|---------|
|
|
34
|
+
| **Browser (GitHub)** | https://github.com/techionext/Pixel-Global/tree/main/packages/pixel/docs/public |
|
|
35
|
+
| **Após npm install** | `node_modules/@beworke/pixel/docs/public/` |
|
|
36
|
+
|
|
37
|
+
O site **npmjs.com não abre** arquivos `.md` individuais (ex.: `npmjs.com/package/@beworke/docs/...` → 404). Isso é normal.
|
|
38
|
+
|
|
39
|
+
## Tarball local (opcional)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install ./beworke-pixel-0.1.0-rc.6.tgz
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Validar instalação limpa
|
|
46
|
+
|
|
47
|
+
Na raiz do monorepo:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm pack:pixel
|
|
51
|
+
pnpm validate:pixel-package
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
O tarball fica em `artifacts/` (não use `pnpm --filter @beworke/pixel pack` como fluxo principal).
|
|
55
|
+
|
|
56
|
+
## Imports recomendados
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { Pixel, DEFAULT_PIXEL_CONFIG, type PixelConfig } from '@beworke/pixel';
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Subpaths adicionais: [Package exports](../api/exports.md).
|
|
63
|
+
|
|
64
|
+
## CDN / script tag
|
|
65
|
+
|
|
66
|
+
```html
|
|
67
|
+
<script src="https://unpkg.com/@beworke/pixel@rc/dist/v2/global.global.js"></script>
|
|
68
|
+
<script>
|
|
69
|
+
const { Pixel, DEFAULT_PIXEL_CONFIG } = window.PixelV2;
|
|
70
|
+
</script>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Detalhes: [Script tag](./script-tag.md).
|
|
74
|
+
|
|
75
|
+
## O que não instalar
|
|
76
|
+
|
|
77
|
+
- Não importe de `src/` — use apenas exports do pacote publicados no tarball.
|
|
78
|
+
- Não dependa de `./diagnostics` — não é subpath público no `package.json` RC.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Quick start
|
|
2
|
+
|
|
3
|
+
## 1. Config mínima
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
import { Pixel, DEFAULT_PIXEL_CONFIG } from '@beworke/pixel';
|
|
7
|
+
|
|
8
|
+
const pixel = new Pixel({
|
|
9
|
+
...DEFAULT_PIXEL_CONFIG,
|
|
10
|
+
identity: {
|
|
11
|
+
pixelId: 'pix_YOUR_ID',
|
|
12
|
+
},
|
|
13
|
+
transport: {
|
|
14
|
+
...DEFAULT_PIXEL_CONFIG.transport,
|
|
15
|
+
apiEndpoint: 'https://your-pixel-api.example.com',
|
|
16
|
+
},
|
|
17
|
+
storage: {
|
|
18
|
+
...DEFAULT_PIXEL_CONFIG.storage,
|
|
19
|
+
persistence: {
|
|
20
|
+
visitor: 'localStorage',
|
|
21
|
+
session: 'sessionStorage',
|
|
22
|
+
attribution: 'localStorage',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 2. Inicializar
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
await pixel.init();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`init()` é assíncrono. Aguarde antes de disparar conversões manuais se depender de sessão/visitor prontos.
|
|
35
|
+
|
|
36
|
+
## 3. Eventos automáticos
|
|
37
|
+
|
|
38
|
+
Com `modules.core.enabled` e `modules.behavior.enabled` (defaults), após `init()`:
|
|
39
|
+
|
|
40
|
+
- `PAGE_VIEW` (core)
|
|
41
|
+
- Sinais de behavior (scroll, cliques, heartbeat, etc.) conforme config
|
|
42
|
+
|
|
43
|
+
## 4. Conversão manual
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
await pixel.purchase({
|
|
47
|
+
transactionId: 'order_123',
|
|
48
|
+
value: 197,
|
|
49
|
+
currency: 'BRL',
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Outros métodos: `lead`, `addToCart`, `removeFromCart`, `initiateCheckout`, `addPaymentInfo`, `viewContent`, `search`.
|
|
54
|
+
|
|
55
|
+
## 5. Encerrar (SPA / navegação)
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
await pixel.destroy();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Em React/Next, chame `destroy()` no cleanup do `useEffect`.
|
|
62
|
+
|
|
63
|
+
## 6. Debug (somente desenvolvimento)
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
if (pixel.isInitialized()) {
|
|
67
|
+
console.log(pixel.getDebugSnapshot());
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`getDebugSnapshot()` é público; não use `getDebugServices()` (interno).
|
|
72
|
+
|
|
73
|
+
## Próximos passos
|
|
74
|
+
|
|
75
|
+
- [Configuração](../configuration/overview.md)
|
|
76
|
+
- [Catálogo de eventos](../events/catalog.md)
|
|
77
|
+
- [Funil checkout](../guides/funnel-checkout.md)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# React e Next.js (App Router)
|
|
2
|
+
|
|
3
|
+
O SDK não exporta hooks React. O padrão recomendado é um hook **local** no app.
|
|
4
|
+
|
|
5
|
+
## Hook local (`usePixel`)
|
|
6
|
+
|
|
7
|
+
Referência: `apps/playground-next/lib/use-pixel.ts`
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
'use client';
|
|
11
|
+
|
|
12
|
+
import { Pixel } from '@beworke/pixel';
|
|
13
|
+
import { useEffect, useRef, useState } from 'react';
|
|
14
|
+
import { createPixelConfig } from './pixel-config';
|
|
15
|
+
|
|
16
|
+
export function usePixel() {
|
|
17
|
+
const pixelRef = useRef<Pixel | null>(null);
|
|
18
|
+
const [ready, setReady] = useState(false);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const pixel = new Pixel(createPixelConfig());
|
|
22
|
+
pixelRef.current = pixel;
|
|
23
|
+
|
|
24
|
+
pixel.init().then(() => setReady(true));
|
|
25
|
+
|
|
26
|
+
return () => {
|
|
27
|
+
void pixel.destroy();
|
|
28
|
+
pixelRef.current = null;
|
|
29
|
+
setReady(false);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
|
|
33
|
+
return { pixel: pixelRef, ready };
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Config por página/funil
|
|
38
|
+
|
|
39
|
+
Centralize em `createPixelConfig()` (`apps/playground-next/lib/pixel-config.ts`):
|
|
40
|
+
|
|
41
|
+
- `identity.funnelId`, `funnelStepId`, `pageId` por etapa do funil
|
|
42
|
+
- `commerce.catalog` para produtos da oferta
|
|
43
|
+
- `storage.persistence` com `sessionStorage` para sessão sobreviver a reloads
|
|
44
|
+
|
|
45
|
+
## SSR
|
|
46
|
+
|
|
47
|
+
- Instancie `Pixel` apenas no cliente (`'use client'`).
|
|
48
|
+
- Não chame `init()` no servidor.
|
|
49
|
+
- `destroy()` no unmount evita listeners duplicados.
|
|
50
|
+
|
|
51
|
+
## Checkout
|
|
52
|
+
|
|
53
|
+
`apps/playground-next/app/checkout/page.tsx` demonstra `initiateCheckout`, `addPaymentInfo`, `purchase` com catálogo commerce.
|
|
54
|
+
|
|
55
|
+
Guia: [Funil checkout](../guides/funnel-checkout.md).
|