cdp-edge 1.26.0 → 1.28.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/README.md +179 -459
- package/contracts/api-versions.json +6 -6
- package/dist/sdk/cdpTrack.js +2095 -0
- package/dist/sdk/cdpTrack.min.js +64 -0
- package/dist/sdk/install-snippet.html +10 -0
- package/extracted-skill/tracking-events-generator/agents/devops-agent.md +22 -0
- package/extracted-skill/tracking-events-generator/agents/intelligence-agent.md +53 -0
- package/extracted-skill/tracking-events-generator/agents/lead-scoring-agent.md +282 -0
- package/extracted-skill/tracking-events-generator/agents/master-orchestrator.md +60 -6
- package/extracted-skill/tracking-events-generator/agents/match-quality-agent.md +304 -0
- package/extracted-skill/tracking-events-generator/agents/utm-agent.md +285 -154
- package/extracted-skill/tracking-events-generator/anti-blocking.js +1 -1
- package/extracted-skill/tracking-events-generator/cdpTrack.js +10 -18
- package/extracted-skill/tracking-events-generator/contracts/api-versions.json +6 -6
- package/extracted-skill/tracking-events-generator/engagement-scoring.js +2 -2
- package/extracted-skill/tracking-events-generator/micro-events.js +1 -1
- package/extracted-skill/tracking-events-generator/models/quiz-funnel.md +83 -19
- package/extracted-skill/tracking-events-generator/tracking.config.js +3 -3
- package/package.json +5 -1
- package/scripts/build-sdk.js +106 -0
- package/server-edge-tracker/index.ts +89 -11
- package/server-edge-tracker/modules/dispatch/platforms.ts +16 -0
- package/server-edge-tracker/modules/intelligence.ts +155 -2
- package/server-edge-tracker/modules/ml/quiz.ts +343 -0
- package/server-edge-tracker/modules/ml/roas.ts +255 -0
- package/server-edge-tracker/modules/nurture.ts +257 -0
- package/server-edge-tracker/modules/utils.ts +2 -0
- package/server-edge-tracker/schema-quiz.sql +52 -0
- package/server-edge-tracker/schema-sales-engine.sql +113 -0
- package/templates/quiz-funnel.md +83 -19
package/README.md
CHANGED
|
@@ -2,549 +2,269 @@
|
|
|
2
2
|
|
|
3
3
|
**Padrão Quantum Tracking: 100% Cloudflare Edge.** Sem GTM. Sem Stape. Sem cookies de terceiros.
|
|
4
4
|
|
|
5
|
-
> **v2.
|
|
6
|
-
|
|
7
|
-
> **v2.3.
|
|
8
|
-
|
|
9
|
-
### Novidades
|
|
10
|
-
- graphify obrigatório em todas as sessões (CLAUDE.md)
|
|
11
|
-
- Git hooks instalados (post-commit, post-checkout)
|
|
12
|
-
- Hook corrigido para UTF-8 nativo no Windows
|
|
13
|
-
- Redução de custo documentada (40–90% economia ao navegar grafo)
|
|
14
|
-
- Tripé de documentação sincronizado (README + CLAUDE.md + Business Book)
|
|
15
|
-
|
|
16
|
-
### Correções
|
|
17
|
-
- Hook post-commit corrigido para encoding UTF-8
|
|
18
|
-
- Rebuild code-only funcional após cada commit
|
|
19
|
-
- Push para ts/main (CDP-Edge-Premium.ts.git) concluído
|
|
5
|
+
> **v2.5.0** — Sales Engine: ROAS Feedback + Nurture Engine + Lookalike Dinâmico (14 de Abril de 2026) 💰
|
|
6
|
+
> **v2.4.0** — Quiz Scoring Engine: Qualificação AI de Respondentes (14 de Abril de 2026) 🤖
|
|
7
|
+
> **v2.3.8** — Fix Definitivo: api-versions.json (14 de Abril de 2026) 🔒
|
|
20
8
|
|
|
21
9
|
---
|
|
22
10
|
|
|
23
|
-
## 📋 CHANGELOG v2.
|
|
24
|
-
|
|
25
|
-
### 🏷️ UTM Agent — Novo Agente para Segmentação de Público
|
|
26
|
-
|
|
27
|
-
**Problema resolvido:**
|
|
28
|
-
- Múltiplos anúncios com diferentes faixas de valor (ex: imóveis 500k-800k, 800k-1.5M, 1M-3M) precisam ser segmentados corretamente para o Meta criar públicos separados
|
|
29
|
-
- Dados sensíveis (valor de preço) não devem estar visíveis na URL pública por segurança
|
|
30
|
-
|
|
31
|
-
**Solução implementada:**
|
|
32
|
-
- **UTMs Obfuscadas:** Valores de faixa são convertidos em hash SHA256 truncado (8 caracteres)
|
|
33
|
-
- `800k-1.5M` → `b4e2a1c9` (obfuscado)
|
|
34
|
-
- Humans veem: `imovel_b4e2a1c9`
|
|
35
|
-
- Worker sabe: `faixa_real = "800k-1.5M"` (de-obfuscado)
|
|
36
|
-
|
|
37
|
-
- **Módulo UTM Enricher:** `server-edge-tracker/modules/utm/utm-enricher.ts`
|
|
38
|
-
- `obfuscateValue()` — gera hash truncado de 8 caracteres
|
|
39
|
-
- `deobfuscateValue()` — de-obfusca usando mapeamento
|
|
40
|
-
- `enrichPayloadWithUTM()` — enriquece payload com segmentação
|
|
41
|
-
- Integração com Meta CAPI: `external_id` segmentado por hash
|
|
42
|
-
|
|
43
|
-
- **Schema D1:** `server-edge-tracker/schema-utm.sql`
|
|
44
|
-
- Tabela `utm_mappings` — persiste mapeamento hash→valor
|
|
45
|
-
- Colunas em `leads`: `faixa_obfuscada`, `faixa_real`, `faixa_category`
|
|
46
|
-
- VIEW `leads_segmented` — para dashboard e exports
|
|
47
|
-
|
|
48
|
-
- **Master Orchestrator Atualizado:** UTM Agent integrado ao fluxo (FASE 2-B)
|
|
49
|
-
- Ordem: Page Analyzer → **UTM Agent** → Premium Intelligence → Browser Tracking
|
|
50
|
-
- Arquivo: `extracted-skill/tracking-events-generator/agents/utm-agent.md`
|
|
11
|
+
## 📋 CHANGELOG v2.5.0 — Sales Engine (14 de Abril de 2026) 💰
|
|
51
12
|
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
USUÁRIO INICIA CDP EDGE
|
|
55
|
-
↓
|
|
56
|
-
FASE 1: Seleção de plataformas + credenciais
|
|
57
|
-
↓
|
|
58
|
-
FASE 2: Page Analyzer (identifica tipo de página)
|
|
59
|
-
↓
|
|
60
|
-
FASE 2-B: UTM Agent ← NOVO
|
|
61
|
-
→ Pergunta: "Qual a faixa de valor deste imóvel?"
|
|
62
|
-
→ Gera: URL obfuscada + mapeamento hash→valor
|
|
63
|
-
↓
|
|
64
|
-
FASE 3+: Continua fluxo normal (Premium Intelligence, Browser Tracking, etc.)
|
|
65
|
-
```
|
|
13
|
+
### O que foi adicionado
|
|
66
14
|
|
|
67
|
-
**
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
```
|
|
15
|
+
**ROAS Feedback Loop** (`modules/ml/roas.ts`)
|
|
16
|
+
- Cruza leads com compras reais por campanha no D1
|
|
17
|
+
- Calcula: `conversion_rate`, `revenue_per_lead`, `ltv_accuracy` (valida o modelo preditivo)
|
|
18
|
+
- Recomendação automática de bid: `increase | maintain | decrease | pause`
|
|
19
|
+
- Relatório semanal via CallMeBot com top campanhas e alertas
|
|
20
|
+
- Persiste histórico em `roas_reports` + VIEW `v_roas_latest`
|
|
74
21
|
|
|
75
|
-
**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
22
|
+
**Nurture Engine** (`modules/nurture.ts`)
|
|
23
|
+
- Sequências automáticas pós-quiz por qualificação:
|
|
24
|
+
- `interessado` → D+1, D+3, D+7 (WhatsApp)
|
|
25
|
+
- `curioso` → D+2, D+5 (conteúdo)
|
|
26
|
+
- `comprador` → contato imediato via hot lead (já existente)
|
|
27
|
+
- `perdido` → `cohort_label = excluded` (remove do remarketing)
|
|
28
|
+
- `scheduleNurture()` chamado no QuizComplete em background
|
|
29
|
+
- `runNurtureQueue()` executado pelo Intelligence Agent (cron diário)
|
|
30
|
+
- D1: `nurture_sequences` + VIEWs de fila e stats
|
|
83
31
|
|
|
84
|
-
|
|
32
|
+
**Lookalike Dinâmico** (`syncMetaLookalikeSeed()` em intelligence.ts)
|
|
33
|
+
- Seed de Lookalike com compradores CONFIRMADOS (Purchase event) — não apenas high_intent
|
|
34
|
+
- Une compradores reais + leads qualificados como `comprador` no quiz
|
|
35
|
+
- Atualiza `cohort_label = buyer_confirmed` nos perfis
|
|
36
|
+
- Persiste histórico em `lookalike_seeds`
|
|
37
|
+
- Roda automaticamente no cron semanal do Intelligence Agent
|
|
85
38
|
|
|
86
|
-
-
|
|
87
|
-
- Versões alinhadas: package.json, CHANGELOG, README
|
|
88
|
-
- Referências cruzadas: agents, modules, schemas
|
|
89
|
-
|
|
90
|
-
### Breaking Changes
|
|
91
|
-
|
|
92
|
-
- Nenhuma. API HTTP e comportamento em runtime são idênticos.
|
|
39
|
+
**Schema D1**: `schema-sales-engine.sql` — `roas_reports`, `nurture_sequences`, `lookalike_seeds` + 5 VIEWs
|
|
93
40
|
|
|
94
41
|
### Migração
|
|
95
|
-
|
|
96
|
-
Para projetos existentes:
|
|
97
42
|
```bash
|
|
98
|
-
# Aplicar schema UTM (adicional)
|
|
99
43
|
cd server-edge-tracker
|
|
100
|
-
wrangler d1 execute cdp-edge-db --file=schema-
|
|
101
|
-
|
|
102
|
-
# Configurar utm-mapping.json (manual ou via UTM Agent)
|
|
103
|
-
cp config/utm-mapping.json.example config/utm-mapping.json
|
|
104
|
-
|
|
105
|
-
# Deploy
|
|
44
|
+
wrangler d1 execute cdp-edge-db --file=schema-sales-engine.sql --remote
|
|
106
45
|
wrangler deploy
|
|
107
46
|
```
|
|
108
47
|
|
|
109
48
|
---
|
|
110
49
|
|
|
111
|
-
|
|
50
|
+
## 📋 CHANGELOG v2.4.0 — Quiz Scoring Engine (14 de Abril de 2026) 🤖
|
|
112
51
|
|
|
113
|
-
|
|
52
|
+
**Quiz Scoring Engine** (`modules/ml/quiz.ts`) — análise dimensional automática via Granite 4.0 Micro:
|
|
53
|
+
- Detecta o TIPO de cada pergunta: `urgency | budget | timeline | fit | engagement | awareness | objection`
|
|
54
|
+
- Atribui peso automático por dimensão (budget/urgency=5, fit=4, timeline=3, engagement=2)
|
|
55
|
+
- Score ponderado → `comprador | interessado | curioso | perdido`
|
|
56
|
+
- Fallback heurístico por palavras-chave quando AI indisponível
|
|
57
|
+
- `quiz_sessions` no D1 com breakdown completo por dimensão
|
|
114
58
|
|
|
115
|
-
|
|
59
|
+
**Integração no pipeline `/track`**:
|
|
60
|
+
- `QuizComplete` + `quiz_answers[]` → scoring antes do LTV
|
|
61
|
+
- `intentionLevel` qualificado alimenta LTV Prediction → `comprador` = LTV High automático
|
|
62
|
+
- `QuizComplete` adicionado ao `LTV_EVENTS`
|
|
116
63
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
**A Linha de Montagem Sincronizada (A Prova de Latência)**
|
|
120
|
-
Meu ecossistema opera como um Cérebro de Conversão Privado na borda. Quando um evento de Lead bate no endpoint `/track`:
|
|
121
|
-
1. **O Escudo Frontal (Fraud Gate):** Inspeciono IP, ASN e Velocity na borda. Bloqueio bots silenciosamente antes mesmo deles carregarem.
|
|
122
|
-
2. **A Roleta Invisível (A/B LTV):** Faço o sorteio de prompts para testes A/B via KV Cache em ~0ms.
|
|
123
|
-
3. **O Cérebro Financeiro (LTV Predictor):** Rodo Machine Learning (Granite 4.0 Micro) para qualificar a intenção e gerar o LTV Preditivo.
|
|
124
|
-
4. **Envio para as Plataformas:** O Facebook/Google/LinkedIn recebem um payload limpo (sem bot) recheado com valor financeiro de intenção extrema.
|
|
125
|
-
5. **Máquina Autônoma (Background):** Meu banco SQLite (D1) retroalimenta os processos de Clustering (Fase 1) e Bidding (Fase 2) de forma autônoma pelas costas do usuário (`ctx.waitUntil`).
|
|
126
|
-
|
|
127
|
-
**Minha Vantagem Absoluta (A "Killer Feature")**
|
|
128
|
-
- **A Extinção da Latência:** Destruo concorrentes como GTM/Stape mitigando a latência do servidor (+150ms) para as antenas da Cloudflare Brasileira (~5ms). Custando absurdamente menos (Tier Free ou $5/mês na infraestrutura).
|
|
129
|
-
- **Cookies Indestrutíveis:** Meus *First-Party Cookies Seguros* originam diretamente da nuvem, imunes hoje às varreduras massivas de 24 horas usadas por AdBlockers e Safari (Apple ITP).
|
|
130
|
-
- **Filas Inquebráveis (Fail-Safe + Queues):** Se a AI Cloudflare cair ocasionalmente, eu recuo pro LTV $0. Se a Meta CAPI espirrar 500 downtime, o sistema guarda religiosamente os seus eventos caros em *Cloudflare Queues* e faz o retry sucessivo. Sou incansável na garantia de Event Match Quality (EMQ).
|
|
64
|
+
**Migração**: `wrangler d1 execute cdp-edge-db --file=schema-quiz.sql --remote`
|
|
131
65
|
|
|
132
66
|
---
|
|
133
67
|
|
|
134
|
-
## 📋 CHANGELOG v2.3.
|
|
135
|
-
|
|
136
|
-
### 🔒 Segurança & Conformidade
|
|
68
|
+
## 📋 CHANGELOG v2.3.8 — Fix Definitivo: api-versions.json (14 de Abril de 2026) 🔒
|
|
137
69
|
|
|
138
|
-
-
|
|
139
|
-
- **Deploy seguro:** novo `deploy-client.js` — lê credenciais de `.client.env` (gitignored), gera `wrangler.deploy.toml` temporário, faz deploy e autodestrói o arquivo. Credenciais de cliente nunca entram no repo
|
|
140
|
-
- **`.gitignore` reforçado:** `.client.env` e `wrangler.deploy.toml` explicitamente ignorados
|
|
141
|
-
- **WhatsApp secrets alinhados à Meta Cloud API v22.0:** `resolvePhoneNumberId()` e `resolveAccessToken()` com fallback canônico → legado — backwards compat garantido
|
|
142
|
-
- **`api-versions.json` v1.1.0:** metadata `updated_at` corrigido para `2026-04-12`
|
|
143
|
-
- **`/health` WhatsApp:** reflete corretamente secrets com nomes canônicos ou legados
|
|
144
|
-
|
|
145
|
-
### 🔧 Deploy de Cliente — Novo Fluxo
|
|
146
|
-
|
|
147
|
-
```bash
|
|
148
|
-
cd server-edge-tracker
|
|
149
|
-
cp .client.env.example .client.env
|
|
150
|
-
# preencher DATABASE_ID, SITE_DOMAIN, pixels
|
|
151
|
-
node deploy-client.js --dry-run # valida sem subir
|
|
152
|
-
node deploy-client.js # deploy real
|
|
153
|
-
```
|
|
70
|
+
`build.js` copia `extracted-skill/.../contracts/` → `contracts/` no `prepare` script. A fonte estava na v1.0.0, sobrescrevendo o arquivo correto a cada `npm publish`. Ambos os arquivos agora sincronizados em v1.1.0.
|
|
154
71
|
|
|
155
72
|
---
|
|
156
73
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
### 🔷 Worker 100% TypeScript — Migração Completa
|
|
160
|
-
|
|
161
|
-
Todo o código server-side (`server-edge-tracker/`) foi migrado de JavaScript para **TypeScript nativo**. O Wrangler compila diretamente o `.ts` via esbuild — sem etapa de build separada, sem configuração extra.
|
|
162
|
-
|
|
163
|
-
**Por que TypeScript muda o jogo no CDP Edge:**
|
|
164
|
-
- **Env tipado** — typos em nomes de secrets (`META_ACCESS_TOKEN`, `GEO_CACHE`, `DB`) viram erros em build time, nunca em produção
|
|
165
|
-
- **TrackPayload contratado** — o shape do payload entre browser e Worker é garantido pelo compilador
|
|
166
|
-
- **Cloudflare types nativos** — D1, KV, R2, Workers AI com autocomplete e validação de métodos
|
|
167
|
-
- **Fraud Gate e ML seguros** — `checkFraudGate(env: Env, request: Request, payload: TrackPayload)` — nenhum `undefined` passa despercebido
|
|
168
|
-
- **Refatoração segura** — renomear qualquer campo do `TrackPayload` lista automaticamente todos os pontos de quebra
|
|
169
|
-
|
|
170
|
-
**Arquivos migrados (JS → TS) — 16 módulos:**
|
|
171
|
-
- `index.ts` — entry point do Worker
|
|
172
|
-
- `types.ts` — **novo** — contratos centralizados: `Env`, `TrackPayload`, `BehavioralData`, `HotmartWebhook`, `KiwifyWebhook`, `TictoWebhook`, `QueueMessage`, `PromiseResult<T>`
|
|
173
|
-
- `modules/utils.ts`, `modules/db.ts`, `modules/intelligence.ts`
|
|
174
|
-
- `modules/dispatch/` — `meta.ts`, `ga4.ts`, `tiktok.ts`, `platforms.ts`, `whatsapp.ts`
|
|
175
|
-
- `modules/ml/` — `ltv.ts`, `fraud.ts`, `bidding.ts`, `segmentation.ts`, `logistic.ts`, `matchquality.ts`
|
|
176
|
-
|
|
177
|
-
**Infraestrutura:**
|
|
178
|
-
- `tsconfig.json` — `target: ESNext`, `moduleResolution: "bundler"`, `strict: true`, `@cloudflare/workers-types`
|
|
179
|
-
- `wrangler.toml` — `main = "index.ts"` (TypeScript nativo via wrangler/esbuild)
|
|
180
|
-
- `contracts/types.ts` — tipos públicos exportados no pacote NPM: `QuantumEventPayload`, `AgencyContext`, `ApiVersionsConfig`
|
|
181
|
-
- `npm run typecheck` — `tsc --noEmit` (225 testes passando, zero erros de compilação)
|
|
182
|
-
|
|
183
|
-
**Breaking change:** nenhuma — API HTTP e comportamento em runtime são idênticos. TypeScript é invisível para o Cloudflare.
|
|
184
|
-
|
|
185
|
-
---
|
|
186
|
-
|
|
187
|
-
## 📋 CHANGELOG v2.2.5 (11 de Abril de 2026)
|
|
188
|
-
|
|
189
|
-
### 🔧 Correção de Versão Dinâmica
|
|
190
|
-
|
|
191
|
-
- **Versão Dinâmica**: `bin/cdp-edge.js` e `dist/commands/install.js` agora leem a versão do `package.json` dinamicamente
|
|
192
|
-
- **Banner Corrigido**: O banner de instalação agora mostra sempre a versão correta (`cdp-edge --version`)
|
|
193
|
-
- **Compatibilidade**: Garante que a versão exibida no CLI e banner esteja sempre sincronizada com o `package.json`
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## 📋 CHANGELOG v2.2.0 (10 de Abril de 2026)
|
|
198
|
-
|
|
199
|
-
### 🤖 AI Engine Upgrade — Novos Modelos
|
|
200
|
-
|
|
201
|
-
- **LTV Prediction**: `@cf/meta/llama-3.1-8b-instruct` → **`@cf/ibm-granite/granite-4.0-h-micro`** (menor latência, otimizado para edge e function calling)
|
|
202
|
-
- **ML Clustering**: algoritmo LLM simulado → **K-means vetorial real** com embeddings `@cf/baai/bge-m3` (distância cosseno, K-means++ inicialização, silhouette score real)
|
|
203
|
-
- Granite continua sendo usado para naming dos segmentos pós-clustering
|
|
204
|
-
|
|
205
|
-
### 🧹 Limpeza (Zero Lixo)
|
|
206
|
-
|
|
207
|
-
- Removido: detecção de emails descartáveis (mailinator, guerrilla, tempmail, etc.) do Fraud Gate e do agente `fraud-detection-agent.md`
|
|
208
|
-
- Removido: secrets `WEBHOOK_SECRET_HOTMART` e `WEBHOOK_SECRET_KIWIFY` (wrangler + wrangler.toml)
|
|
209
|
-
|
|
210
|
-
### 🔧 Observability
|
|
211
|
-
|
|
212
|
-
- Adicionado bloco `[observability]` no `wrangler.toml` (`logs.enabled = true`, `traces.enabled = false`)
|
|
74
|
+
> ⚠️ **REGRA DE OURO (SQUAD):** Todas as atualizações devem ser documentadas de forma sincronizada em `README.md`, `CLAUDE.md` e `CDP-EDGE-BUSINESS-BOOK.md`. Nenhuma alteração passa sem esse tripé.
|
|
213
75
|
|
|
214
76
|
---
|
|
215
77
|
|
|
216
|
-
##
|
|
78
|
+
## 🤖 MANIFESTO: EU, CDP EDGE
|
|
217
79
|
|
|
218
|
-
|
|
80
|
+
*Eu não sou um simples "script de pixel". Eu sou uma arquitetura **Enterprise Tier 10** nascida e construída 100% nativa na infraestrutura da Cloudflare.*
|
|
219
81
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
- **Testes**: bugs críticos em `deduplication.test.js` corrigidos (template literals escapados, prefixo errado)
|
|
229
|
-
- **npm**: lodash 4.17.23 → 4.18.1, node-fetch removido
|
|
82
|
+
Quando um evento de Lead bate no endpoint `/track`:
|
|
83
|
+
1. **Fraud Gate:** Bloqueio bots silenciosamente antes de qualquer processamento (~2ms via KV)
|
|
84
|
+
2. **Quiz Scoring Engine:** Classifico as respostas do quiz com Granite 4.0 Micro — `comprador | interessado | curioso | perdido`
|
|
85
|
+
3. **A/B LTV Testing:** Sorteio de prompt via KV Cache em ~0ms
|
|
86
|
+
4. **LTV Predictor:** Machine Learning para qualificar intenção e gerar valor preditivo em BRL
|
|
87
|
+
5. **Nurture Scheduler:** Agendar sequência de follow-up baseada na qualificação (background)
|
|
88
|
+
6. **CAPI Dispatch:** Meta/GA4/TikTok recebem payload limpo com LTV e intention injetados
|
|
89
|
+
7. **Sales Engine:** Semanalmente, calculo ROAS real por campanha e atualizo o seed de Lookalike com compradores confirmados
|
|
230
90
|
|
|
231
91
|
---
|
|
232
92
|
|
|
233
|
-
##
|
|
234
|
-
|
|
235
|
-
### 🆕 Sprint Enterprise — Fases 1 a 4
|
|
236
|
-
|
|
237
|
-
#### ✅ Fase 1 — ML Clustering (Segmentação Dinâmica)
|
|
238
|
-
- **`POST /api/segmentation/cluster`** — K-means / DBSCAN / Hierarchical via Workers AI
|
|
239
|
-
- **`GET /api/segmentation/list`** — Segmentos ativos com métricas
|
|
240
|
-
- **`GET /api/segmentation/outliers`** — Detecção de outliers comportamentais
|
|
241
|
-
- **`PUT /api/segmentation/update`** — Atualização de metadados de segmento
|
|
242
|
-
- Schema D1: `ml_segments`, `ml_segment_members` + VIEWs otimizadas
|
|
243
|
-
- Agente: `ml-clustering-agent.md`
|
|
244
|
-
|
|
245
|
-
#### ✅ Fase 2 — Bidding Recommendations (Otimização de Bids ML)
|
|
246
|
-
- **`POST /api/bidding/recommend`** — Bid otimizado por segmento × plataforma (Meta/Google/TikTok), calculado com fórmula `LTV × ROI target / CPA base`
|
|
247
|
-
- **`GET /api/bidding/history`** — Histórico completo de recomendações
|
|
248
|
-
- **`GET /api/bidding/status`** — Snapshot atual das recomendações ativas por vertical
|
|
249
|
-
- Schema D1: `bid_recommendations` + VIEW `v_active_bid_recommendations`
|
|
250
|
-
- Agente: `bidding-agent.md`
|
|
251
|
-
|
|
252
|
-
#### ✅ Fase 3 — A/B Testing de Prompts LTV
|
|
253
|
-
- **`POST /api/ltv/ab-test/create`** — Cria experimento com múltiplas variações de system prompt
|
|
254
|
-
- **`GET /api/ltv/ab-test/list`** — Lista experimentos com status e progresso
|
|
255
|
-
- **`GET /api/ltv/ab-test/results`** — Accuracy score por variação + recomendação automática de winner
|
|
256
|
-
- **`POST /api/ltv/ab-test/winner`** — Declara vencedor e retorna o prompt ganador
|
|
257
|
-
- Integração automática: cada evento Lead sorteia a variação ativa e registra o assignment via KV cache
|
|
258
|
-
- Schema D1: `ltv_ab_tests`, `ltv_ab_variations`, `ltv_ab_assignments` + VIEW `v_ab_test_performance`
|
|
259
|
-
- Agente: `ab-ltv-agent.md`
|
|
260
|
-
|
|
261
|
-
#### ✅ Fase 4 — Fraud Detection Engine
|
|
262
|
-
- **Fraud Gate automático em `/track`** — roda ANTES de qualquer processamento (heurístico puro, ~2ms)
|
|
263
|
-
- Silent drop (retorna 200 falso) — bots não detectam a defesa
|
|
264
|
-
- **`GET /api/fraud/stats`** — Dashboard de fraude (últimas 24h)
|
|
265
|
-
- **`GET /api/fraud/alerts`** — Log de sinais detectados com filtros
|
|
266
|
-
- **`GET /api/fraud/blocklist`** — IPs/fingerprints atualmente bloqueados
|
|
267
|
-
- **`POST /api/fraud/blocklist/add`** — Bloquear IP ou fingerprint (via KV, efeito imediato)
|
|
268
|
-
- **`DELETE /api/fraud/blocklist/remove`** — Remover do blocklist
|
|
269
|
-
- Sinais detectados: bot_score, datacenter IP, velocity attack, headless UA, sem Accept-Language
|
|
270
|
-
- Schema D1: `fraud_signals`, `fraud_alerts` + VIEW `v_fraud_dashboard`
|
|
271
|
-
- Agente: `fraud-detection-agent.md`
|
|
272
|
-
|
|
273
|
-
### 🔧 Fix: `wrangler.toml` atualizado
|
|
274
|
-
- Todos os placeholders (`SEU_D1_DATABASE_ID`, `SEU_KV_NAMESPACE_ID`) substituídos pelos IDs reais da conta Cloudflare
|
|
275
|
-
- D1: `SEU_DATABASE_ID`
|
|
276
|
-
- KV: `SEU_KV_ID`
|
|
93
|
+
## 🏗️ ARQUITETURA QUANTUM ENTERPRISE
|
|
277
94
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
Queue -->|Server Dispatch| Google[GA4 / Google Ads]
|
|
295
|
-
Queue -->|Server Dispatch| TikTok[TikTok API v1.3]
|
|
296
|
-
D1 -->|Reports| Dash[Dashboard Agent]
|
|
95
|
+
```
|
|
96
|
+
POST /track (QuizComplete)
|
|
97
|
+
│
|
|
98
|
+
├─ [1] 🛡️ Fraud Gate (KV blocklist + velocity) ~2ms
|
|
99
|
+
├─ [2] 🤖 Quiz Scoring Engine (Granite 4.0 Micro) → comprador/interessado/curioso/perdido
|
|
100
|
+
├─ [3] 🔮 A/B LTV Sorting (KV cache ~0ms)
|
|
101
|
+
├─ [4] 🧮 LTV Prediction (Granite 4.0 Micro) — intent qualificado → High LTV
|
|
102
|
+
├─ [5] 💾 D1 Writes background (quiz_sessions + leads + nurture_sequences)
|
|
103
|
+
└─ [6] 📡 CAPI paralelo (Meta v22.0 + GA4 + TikTok v1.3)
|
|
104
|
+
|
|
105
|
+
Cron semanal (Intelligence Agent):
|
|
106
|
+
├─ ROAS Feedback — cruza leads × purchases por campanha → bid recommendation
|
|
107
|
+
├─ Nurture Queue — envia D+1/D+3/D+7 para leads qualificados
|
|
108
|
+
├─ Lookalike Seed — compradores confirmados → Meta Custom Audience
|
|
109
|
+
├─ LTV Model Training — regressão logística com dados reais
|
|
110
|
+
└─ A/B LTV Auto-winner — declara vencedor quando amostra suficiente
|
|
297
111
|
```
|
|
298
112
|
|
|
299
113
|
---
|
|
300
114
|
|
|
301
|
-
##
|
|
302
|
-
|
|
303
|
-
O sistema é composto por **43+ agentes** coordenados pelo **Master Orchestrator**:
|
|
304
|
-
|
|
305
|
-
### 🧠 Núcleo de Inteligência
|
|
306
|
-
| Agente | Função |
|
|
307
|
-
|---|---|
|
|
308
|
-
| **Master Orchestrator** | Coordenação central — guia todo o setup do projeto |
|
|
309
|
-
| **Page Analyzer** | Mapeamento automático de CTAs, Forms e nicho do site |
|
|
310
|
-
| **Validator Agent** | Auditoria de código, segurança e conformidade de APIs |
|
|
311
|
-
| **Memory Agent** | Contexto e checkpoints da sessão por projeto |
|
|
312
|
-
| **Intelligence Agent** | Monitoramento de versões de API (Meta v22.0+, etc) |
|
|
313
|
-
|
|
314
|
-
### 🚀 Plataformas de Anúncio
|
|
315
|
-
| Agente | Especialidade |
|
|
316
|
-
|---|---|
|
|
317
|
-
| **Meta Agent** | Facebook Pixel + CAPI v22.0 + WhatsApp CTWA |
|
|
318
|
-
| **Google Agent** | GA4 + Google Ads Enhanced Conversions |
|
|
319
|
-
| **TikTok Agent** | TikTok Pixel + Events API v1.3 |
|
|
320
|
-
| **LinkedIn Agent** | Insight Tag + Conversions API v2 |
|
|
321
|
-
| **Pinterest Agent** | Tag + Conversions API v5 |
|
|
322
|
-
| **Reddit Agent** | Pixel + Conversions API v2.0 |
|
|
323
|
-
| **Spotify Agent** | Pixel + Conversions API v1 |
|
|
324
|
-
| **Bing Agent** | UET Tag + Enhanced Conversions |
|
|
325
|
-
|
|
326
|
-
### 🤖 Enterprise Intelligence (Fase 1–4)
|
|
327
|
-
| Agente | Endpoint Principal | Impacto |
|
|
328
|
-
|---|---|---|
|
|
329
|
-
| **ML Clustering Agent** | `POST /api/segmentation/cluster` | K-means vetorial real (bge-m3 embeddings + Granite naming) |
|
|
330
|
-
| **Bidding Agent** | `POST /api/bidding/recommend` | -20% CPA via bid por segmento de LTV |
|
|
331
|
-
| **A/B LTV Agent** | `POST /api/ltv/ab-test/create` | +25% precisão LTV via test de prompts |
|
|
332
|
-
| **Fraud Detection Agent** | Auto em `/track` | Bloqueia click fraud, bots, velocity attacks |
|
|
333
|
-
|
|
334
|
-
### 🛡️ Módulos Enterprise
|
|
335
|
-
| Agente | Função |
|
|
336
|
-
|---|---|
|
|
337
|
-
| **Attribution Agent** | Atribuição Multi-Touch de alta fidelidade |
|
|
338
|
-
| **Security Agent** | Rate Limiting, AES-256 e Bot Defense |
|
|
339
|
-
| **Compliance Agent** | LGPD e GDPR (Consent Mode v2) |
|
|
340
|
-
| **Performance Agent** | Otimização de caches e queries D1 |
|
|
341
|
-
|
|
342
|
-
---
|
|
343
|
-
|
|
344
|
-
## 📊 BANCO DE DADOS D1 — 21 Tabelas
|
|
115
|
+
## 📊 BANCO DE DADOS D1 — 25 Tabelas + 12 VIEWs
|
|
345
116
|
|
|
346
117
|
```
|
|
347
|
-
CORE TRACKING
|
|
348
|
-
|
|
349
|
-
leads
|
|
350
|
-
events
|
|
351
|
-
sessions
|
|
352
|
-
webhook_events
|
|
353
|
-
api_failures
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
118
|
+
CORE TRACKING ML & INTELLIGENCE SALES ENGINE
|
|
119
|
+
────────────── ───────────────────── ──────────────────
|
|
120
|
+
leads ml_segments roas_reports
|
|
121
|
+
events ml_segment_members nurture_sequences
|
|
122
|
+
sessions bid_recommendations lookalike_seeds
|
|
123
|
+
webhook_events ltv_ab_tests quiz_sessions
|
|
124
|
+
api_failures ltv_ab_variations
|
|
125
|
+
device_graph ltv_ab_assignments
|
|
126
|
+
user_profiles fraud_signals
|
|
127
|
+
intelligence_logs fraud_alerts
|
|
128
|
+
messaging_history match_quality_logs
|
|
129
|
+
automation_rules utm_mappings
|
|
130
|
+
edge_fingerprints
|
|
131
|
+
|
|
132
|
+
VIEWS (12)
|
|
133
|
+
──────────────────────────────────────────────────────────────────
|
|
134
|
+
v_active_segments v_active_bid_recs
|
|
135
|
+
v_ab_test_performance v_fraud_dashboard
|
|
136
|
+
v_quiz_qualification_summary v_quiz_dimension_impact
|
|
137
|
+
v_roas_latest v_nurture_pending
|
|
138
|
+
v_nurture_stats v_quiz_session_summary
|
|
139
|
+
v_leads_segmented v_ltv_feedback
|
|
361
140
|
```
|
|
362
141
|
|
|
363
142
|
---
|
|
364
143
|
|
|
365
|
-
##
|
|
144
|
+
## 🧠 CATÁLOGO DE MÓDULOS ML
|
|
366
145
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
├─ [3] 🧮 LTV Prediction — Workers AI Granite 4.0 Micro
|
|
379
|
-
│ └─ Score 0-100 → class High/Medium/Low → valor em BRL
|
|
380
|
-
│
|
|
381
|
-
├─ [4] 💾 D1 Writes (background via ctx.waitUntil)
|
|
382
|
-
│ ├─ upsertLtvProfile() → tabela leads
|
|
383
|
-
│ ├─ recordAbAssignment() → ltv_ab_assignments
|
|
384
|
-
│ └─ resolveDeviceGraph() → cross-device linking
|
|
385
|
-
│
|
|
386
|
-
└─ [5] 📡 CAPI dispatch (Meta + GA4 + TikTok em paralelo)
|
|
387
|
-
└─ com LTV injetado no value field
|
|
388
|
-
```
|
|
146
|
+
| Módulo | Arquivo | Função |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| **Quiz Scoring** | `modules/ml/quiz.ts` | Análise dimensional automática das respostas |
|
|
149
|
+
| **LTV Prediction** | `modules/ml/ltv.ts` | Score 0-100 + valor BRL via Granite + A/B test |
|
|
150
|
+
| **Fraud Gate** | `modules/ml/fraud.ts` | Detecção de bots e fraude na borda |
|
|
151
|
+
| **ML Clustering** | `modules/ml/segmentation.ts` | K-means vetorial com bge-m3 embeddings |
|
|
152
|
+
| **Bidding ML** | `modules/ml/bidding.ts` | Recomendação de bid por segmento × plataforma |
|
|
153
|
+
| **ROAS Feedback** | `modules/ml/roas.ts` | ROAS real por campanha, alimenta bidding |
|
|
154
|
+
| **Match Quality** | `modules/ml/matchquality.ts` | Score de qualidade de dados para CAPI |
|
|
155
|
+
| **Logistic** | `modules/ml/logistic.ts` | Regressão logística para LTV model treinável |
|
|
156
|
+
| **Nurture Engine** | `modules/nurture.ts` | Sequências automáticas pós-qualificação |
|
|
389
157
|
|
|
390
158
|
---
|
|
391
159
|
|
|
392
|
-
##
|
|
393
|
-
|
|
394
|
-
### OPÇÃO 1 — Instalação via npm (Recomendada)
|
|
160
|
+
## 🧠 CATÁLOGO DE AGENTES
|
|
395
161
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
162
|
+
| Categoria | Agente | Função |
|
|
163
|
+
|---|---|---|
|
|
164
|
+
| Orquestração | `master-orchestrator.md` | Coordena todo o setup |
|
|
165
|
+
| Análise | `page-analyzer.md` | Detecta CTAs, forms e nicho |
|
|
166
|
+
| Plataformas | `meta-agent.md`, `google-agent.md`, `tiktok-agent.md`... | Especialistas por plataforma |
|
|
167
|
+
| Infra | `server-tracking.md`, `devops-agent.md` | Arquitetura Cloudflare |
|
|
168
|
+
| Enterprise | `ml-clustering-agent.md` | Segmentação dinâmica ML |
|
|
169
|
+
| Enterprise | `bidding-agent.md` | Bids ML por segmento |
|
|
170
|
+
| Enterprise | `ab-ltv-agent.md` | A/B testing de prompts LTV |
|
|
171
|
+
| Enterprise | `fraud-detection-agent.md` | Detecção de fraude na borda |
|
|
172
|
+
| Monitoramento | `intelligence-agent.md` | Cron — ROAS, Nurture, Lookalike, LTV training |
|
|
401
173
|
|
|
402
|
-
|
|
174
|
+
---
|
|
403
175
|
|
|
404
|
-
|
|
405
|
-
npm install -g cdp-edge
|
|
406
|
-
cdp-edge install . --name "Nome do Projeto"
|
|
407
|
-
```
|
|
176
|
+
## 📋 TODOS OS ENDPOINTS
|
|
408
177
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
178
|
+
### Core
|
|
179
|
+
| Rota | Método | Função |
|
|
180
|
+
|---|---|---|
|
|
181
|
+
| `/track` | POST | Evento principal — Fraud Gate → Quiz Scoring → LTV → CAPI |
|
|
182
|
+
| `/health` | GET | Smoke test D1 + KV + AI |
|
|
183
|
+
| `/webhook/ticto` | POST | Purchase webhook (HMAC) |
|
|
184
|
+
| `/export/customer-match` | GET | Export leads para Google Ads |
|
|
413
185
|
|
|
414
|
-
###
|
|
186
|
+
### ML Clustering (Fase 1)
|
|
187
|
+
| Rota | Método | Função |
|
|
188
|
+
|---|---|---|
|
|
189
|
+
| `/api/segmentation/cluster` | POST | K-means vetorial (bge-m3 + Granite) |
|
|
190
|
+
| `/api/segmentation/list` | GET | Segmentos ativos |
|
|
191
|
+
| `/api/segmentation/outliers` | GET | Outliers comportamentais |
|
|
192
|
+
| `/api/segmentation/update` | PUT | Atualiza metadados |
|
|
415
193
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
194
|
+
### Bidding (Fase 2)
|
|
195
|
+
| Rota | Método | Função |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| `/api/bidding/recommend` | POST | Bid por segmento × plataforma |
|
|
198
|
+
| `/api/bidding/history` | GET | Histórico de recomendações |
|
|
199
|
+
| `/api/bidding/status` | GET | Snapshot atual |
|
|
420
200
|
|
|
421
|
-
###
|
|
201
|
+
### A/B LTV (Fase 3)
|
|
202
|
+
| Rota | Método | Função |
|
|
203
|
+
|---|---|---|
|
|
204
|
+
| `/api/ltv/ab-test/create` | POST | Cria experimento |
|
|
205
|
+
| `/api/ltv/ab-test/list` | GET | Lista experimentos |
|
|
206
|
+
| `/api/ltv/ab-test/results` | GET | Accuracy por variação |
|
|
207
|
+
| `/api/ltv/ab-test/winner` | POST | Declara vencedor |
|
|
422
208
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
/
|
|
429
|
-
|
|
209
|
+
### Fraud (Fase 4)
|
|
210
|
+
| Rota | Método | Função |
|
|
211
|
+
|---|---|---|
|
|
212
|
+
| `/api/fraud/stats` | GET | Dashboard 24h |
|
|
213
|
+
| `/api/fraud/alerts` | GET | Log de sinais |
|
|
214
|
+
| `/api/fraud/blocklist` | GET | IPs bloqueados |
|
|
215
|
+
| `/api/fraud/blocklist/add` | POST | Bloquear |
|
|
216
|
+
| `/api/fraud/blocklist/remove` | DELETE | Desbloquear |
|
|
430
217
|
|
|
431
218
|
---
|
|
432
219
|
|
|
433
|
-
## 🚀 DEPLOY COMPLETO
|
|
220
|
+
## 🚀 DEPLOY COMPLETO
|
|
434
221
|
|
|
435
222
|
```bash
|
|
436
223
|
cd server-edge-tracker
|
|
437
224
|
|
|
438
|
-
#
|
|
225
|
+
# Schemas D1 (ordem correta — todos idempotentes)
|
|
439
226
|
wrangler d1 execute cdp-edge-db --file=schema.sql --remote
|
|
440
227
|
wrangler d1 execute cdp-edge-db --file=migrate-v6.sql --remote
|
|
441
|
-
wrangler d1 execute cdp-edge-db --file=schema-segmentation.sql --remote
|
|
442
|
-
wrangler d1 execute cdp-edge-db --file=schema-bidding.sql --remote
|
|
443
|
-
wrangler d1 execute cdp-edge-db --file=schema-ab-ltv.sql --remote
|
|
444
|
-
wrangler d1 execute cdp-edge-db --file=schema-fraud.sql --remote
|
|
228
|
+
wrangler d1 execute cdp-edge-db --file=schema-segmentation.sql --remote
|
|
229
|
+
wrangler d1 execute cdp-edge-db --file=schema-bidding.sql --remote
|
|
230
|
+
wrangler d1 execute cdp-edge-db --file=schema-ab-ltv.sql --remote
|
|
231
|
+
wrangler d1 execute cdp-edge-db --file=schema-fraud.sql --remote
|
|
232
|
+
wrangler d1 execute cdp-edge-db --file=schema-indexes.sql --remote
|
|
233
|
+
wrangler d1 execute cdp-edge-db --file=migrate-v7.sql --remote
|
|
234
|
+
wrangler d1 execute cdp-edge-db --file=schema-utm.sql --remote
|
|
235
|
+
wrangler d1 execute cdp-edge-db --file=schema-quiz.sql --remote # Fase 6
|
|
236
|
+
wrangler d1 execute cdp-edge-db --file=schema-sales-engine.sql --remote # Fase 7
|
|
445
237
|
|
|
446
|
-
#
|
|
238
|
+
# Secrets
|
|
447
239
|
wrangler secret put META_ACCESS_TOKEN
|
|
448
240
|
wrangler secret put GA4_API_SECRET
|
|
449
241
|
wrangler secret put TIKTOK_ACCESS_TOKEN
|
|
450
242
|
|
|
451
|
-
#
|
|
243
|
+
# Deploy
|
|
452
244
|
wrangler deploy
|
|
453
245
|
```
|
|
454
246
|
|
|
455
247
|
---
|
|
456
248
|
|
|
457
|
-
##
|
|
458
|
-
|
|
459
|
-
O **graphify** gera um mapa de conhecimento navegável do projeto (nós, arestas, comunidades). Antes de qualquer trabalho de código:
|
|
249
|
+
## 💻 INSTALAÇÃO
|
|
460
250
|
|
|
461
251
|
```bash
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
/graphify .
|
|
467
|
-
|
|
468
|
-
# 3. Navegue o grafo para entender arquitetura
|
|
469
|
-
/graphify query "como funciona o fraud gate?"
|
|
470
|
-
/graphify query "identity graph → ltv prediction"
|
|
471
|
-
/graphify path "cdp_uid" "cloudflare d1"
|
|
252
|
+
npx cdp-edge install
|
|
253
|
+
# ou
|
|
254
|
+
npm install -g cdp-edge
|
|
255
|
+
cdp-edge install . --name "Nome do Projeto"
|
|
472
256
|
```
|
|
473
257
|
|
|
474
|
-
### O que o grafo fornece
|
|
475
|
-
|
|
476
|
-
- **God Nodes**: abstrações centrais (D1, Meta CAPI v22.0, Intelligence Agent, ML Clustering)
|
|
477
|
-
- **65 comunidades**: grupos lógicos (Multi-Platform Agent Layer, ML Bidding, Browser SDK, etc.)
|
|
478
|
-
- **Surprising Connections**: relações inferidas entre conceitos que você não sabia que eram similares
|
|
479
|
-
- **Redução de custo**: navegar grafo = até 40% menos tokens vs. ler arquivos brutos
|
|
480
|
-
|
|
481
|
-
### Exemplo de uso
|
|
482
|
-
|
|
483
|
-
**❌ Não faça:**
|
|
484
|
-
> "Ler 50 arquivos para entender como o fraud gate conecta com o LTV predictor"
|
|
485
|
-
|
|
486
|
-
**✅ Faça:**
|
|
487
|
-
> `/graphify query "fraud gate → ltv predictor"` — resposta instantânea com caminho completo, arquivos fonte e nível de confiança
|
|
488
|
-
|
|
489
|
-
O grafo fica atualizado automaticamente após cada `git commit` (via hook).
|
|
490
|
-
|
|
491
258
|
---
|
|
492
259
|
|
|
493
|
-
##
|
|
260
|
+
## 🗺️ GRAPHIFY — Navegando o Código
|
|
494
261
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
| Rage Click | -10 pts |
|
|
502
|
-
| **Hot Lead (80+ pts)** | **Dispara High_Intent_Lead** |
|
|
503
|
-
|
|
504
|
-
---
|
|
505
|
-
|
|
506
|
-
## 📋 TODOS OS ENDPOINTS (referência rápida)
|
|
507
|
-
|
|
508
|
-
### Core Tracking
|
|
509
|
-
| Rota | Método | Função |
|
|
510
|
-
|---|---|---|
|
|
511
|
-
| `/track` | POST | Evento principal (browser → CAPI) |
|
|
512
|
-
| `/health` | GET | Smoke test completo |
|
|
513
|
-
| `/webhook/ticto` | POST | Webhook Ticto Purchase |
|
|
514
|
-
|
|
515
|
-
### Intelligence ML
|
|
516
|
-
| Rota | Método | Função |
|
|
517
|
-
|---|---|---|
|
|
518
|
-
| `/api/segmentation/cluster` | POST | Clustering K-means/DBSCAN |
|
|
519
|
-
| `/api/segmentation/list` | GET | Segmentos ativos |
|
|
520
|
-
| `/api/segmentation/outliers` | GET | Outliers comportamentais |
|
|
521
|
-
| `/api/bidding/recommend` | POST | Bid otimizado por segmento |
|
|
522
|
-
| `/api/bidding/history` | GET | Histórico de bids |
|
|
523
|
-
| `/api/bidding/status` | GET | Status por plataforma |
|
|
524
|
-
|
|
525
|
-
### A/B Testing LTV
|
|
526
|
-
| Rota | Método | Função |
|
|
527
|
-
|---|---|---|
|
|
528
|
-
| `/api/ltv/ab-test/create` | POST | Criar experimento |
|
|
529
|
-
| `/api/ltv/ab-test/list` | GET | Listar experimentos |
|
|
530
|
-
| `/api/ltv/ab-test/results` | GET | Accuracy por variação |
|
|
531
|
-
| `/api/ltv/ab-test/winner` | POST | Declarar vencedor |
|
|
532
|
-
|
|
533
|
-
### Fraud Detection
|
|
534
|
-
| Rota | Método | Função |
|
|
535
|
-
|---|---|---|
|
|
536
|
-
| `/api/fraud/stats` | GET | Dashboard 24h |
|
|
537
|
-
| `/api/fraud/alerts` | GET | Log de alertas |
|
|
538
|
-
| `/api/fraud/blocklist` | GET | Lista bloqueada |
|
|
539
|
-
| `/api/fraud/blocklist/add` | POST | Bloquear IP/fingerprint |
|
|
540
|
-
| `/api/fraud/blocklist/remove` | DELETE | Desbloquear |
|
|
541
|
-
|
|
542
|
-
---
|
|
543
|
-
|
|
544
|
-
## 📞 SUPORTE
|
|
545
|
-
|
|
546
|
-
- **Issues**: https://github.com/ricardosoli777/CDP-Edge-Premium/issues
|
|
547
|
-
- **Releases**: https://github.com/ricardosoli777/CDP-Edge-Premium/releases
|
|
262
|
+
```bash
|
|
263
|
+
/graphify . # gera o mapa
|
|
264
|
+
/graphify query "como funciona o quiz scoring?" # exploração BFS
|
|
265
|
+
/graphify query "nurture engine → meta audience" # exploração DFS
|
|
266
|
+
/graphify path "quiz_answers" "meta capi" # menor caminho
|
|
267
|
+
```
|
|
548
268
|
|
|
549
269
|
---
|
|
550
270
|
|