cdp-edge 1.12.0 → 1.14.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 +195 -279
- package/docs/whatsapp-ctwa.md +2 -2
- package/extracted-skill/tracking-events-generator/agents/ab-ltv-agent.md +196 -0
- package/extracted-skill/tracking-events-generator/agents/bidding-agent.md +347 -0
- package/extracted-skill/tracking-events-generator/agents/database-agent.md +7 -7
- package/extracted-skill/tracking-events-generator/agents/devops-agent.md +157 -0
- package/extracted-skill/tracking-events-generator/agents/domain-setup-agent.md +10 -4
- package/extracted-skill/tracking-events-generator/agents/fraud-detection-agent.md +142 -0
- package/extracted-skill/tracking-events-generator/agents/master-orchestrator.md +56 -4
- package/extracted-skill/tracking-events-generator/agents/memory-agent.md +49 -0
- package/extracted-skill/tracking-events-generator/agents/ml-clustering-agent.md +738 -0
- package/extracted-skill/tracking-events-generator/agents/page-analyzer.md +14 -2
- package/package.json +1 -1
- package/server-edge-tracker/INSTALAR.md +195 -20
- package/server-edge-tracker/SEGMENTATION-DOCS.md +444 -0
- package/server-edge-tracker/schema-ab-ltv.sql +97 -0
- package/server-edge-tracker/schema-bidding.sql +86 -0
- package/server-edge-tracker/schema-fraud.sql +90 -0
- package/server-edge-tracker/schema-segmentation.sql +219 -0
- package/server-edge-tracker/schema.sql +1 -1
- package/server-edge-tracker/worker.js +1637 -51
- package/server-edge-tracker/wrangler.toml +20 -2
package/README.md
CHANGED
|
@@ -1,367 +1,283 @@
|
|
|
1
|
-
# 🚀 CDP Edge
|
|
1
|
+
# 🚀 CDP Edge — Quantum Tracking Enterprise
|
|
2
2
|
|
|
3
3
|
**Padrão Quantum Tracking: 100% Cloudflare Edge.** Sem GTM. Sem Stape. Sem cookies de terceiros.
|
|
4
4
|
|
|
5
|
-
> **v1.
|
|
6
|
-
|
|
7
|
-
- **Precisão Máxima**: Meta CAPI v22.0+, GA4 MP e TikTok Events API v1.3.
|
|
8
|
-
- **Identity Graph**: Persistência de leads e eventos via Cloudflare D1.
|
|
9
|
-
- **Anti-Adblock**: Endpoint Same-Domain indetectável.
|
|
10
|
-
- **Human-Behavior Engine**: Score de engajamento (0-100) em tempo real.
|
|
11
|
-
- **Queue Retry**: Zero perda de conversão — eventos com falha reenfileirados automaticamente.
|
|
12
|
-
- **Geo Intelligence**: Cidade, estado e CEP em todos os eventos (Workers Paid).
|
|
5
|
+
> **v1.4.0** — Enterprise-Level Intelligence Engine · Cloudflare Workers · Meta CAPI v22.0 · GA4 MP · TikTok Events API v1.3
|
|
13
6
|
|
|
14
7
|
---
|
|
15
8
|
|
|
16
|
-
##
|
|
9
|
+
## 📋 CHANGELOG v1.4.0 (9 de Abril de 2026)
|
|
10
|
+
|
|
11
|
+
### 🆕 Sprint Enterprise — Fases 1 a 4
|
|
12
|
+
|
|
13
|
+
#### ✅ Fase 1 — ML Clustering (Segmentação Dinâmica)
|
|
14
|
+
- **`POST /api/segmentation/cluster`** — K-means / DBSCAN / Hierarchical via Workers AI
|
|
15
|
+
- **`GET /api/segmentation/list`** — Segmentos ativos com métricas
|
|
16
|
+
- **`GET /api/segmentation/outliers`** — Detecção de outliers comportamentais
|
|
17
|
+
- **`PUT /api/segmentation/update`** — Atualização de metadados de segmento
|
|
18
|
+
- Schema D1: `ml_segments`, `ml_segment_members` + VIEWs otimizadas
|
|
19
|
+
- Agente: `ml-clustering-agent.md`
|
|
20
|
+
|
|
21
|
+
#### ✅ Fase 2 — Bidding Recommendations (Otimização de Bids ML)
|
|
22
|
+
- **`POST /api/bidding/recommend`** — Bid otimizado por segmento × plataforma (Meta/Google/TikTok), calculado com fórmula `LTV × ROI target / CPA base`
|
|
23
|
+
- **`GET /api/bidding/history`** — Histórico completo de recomendações
|
|
24
|
+
- **`GET /api/bidding/status`** — Snapshot atual das recomendações ativas por vertical
|
|
25
|
+
- Schema D1: `bid_recommendations` + VIEW `v_active_bid_recommendations`
|
|
26
|
+
- Agente: `bidding-agent.md`
|
|
27
|
+
|
|
28
|
+
#### ✅ Fase 3 — A/B Testing de Prompts LTV
|
|
29
|
+
- **`POST /api/ltv/ab-test/create`** — Cria experimento com múltiplas variações de system prompt
|
|
30
|
+
- **`GET /api/ltv/ab-test/list`** — Lista experimentos com status e progresso
|
|
31
|
+
- **`GET /api/ltv/ab-test/results`** — Accuracy score por variação + recomendação automática de winner
|
|
32
|
+
- **`POST /api/ltv/ab-test/winner`** — Declara vencedor e retorna o prompt ganador
|
|
33
|
+
- Integração automática: cada evento Lead sorteia a variação ativa e registra o assignment via KV cache
|
|
34
|
+
- Schema D1: `ltv_ab_tests`, `ltv_ab_variations`, `ltv_ab_assignments` + VIEW `v_ab_test_performance`
|
|
35
|
+
- Agente: `ab-ltv-agent.md`
|
|
36
|
+
|
|
37
|
+
#### ✅ Fase 4 — Fraud Detection Engine
|
|
38
|
+
- **Fraud Gate automático em `/track`** — roda ANTES de qualquer processamento (heurístico puro, ~2ms)
|
|
39
|
+
- Silent drop (retorna 200 falso) — bots não detectam a defesa
|
|
40
|
+
- **`GET /api/fraud/stats`** — Dashboard de fraude (últimas 24h)
|
|
41
|
+
- **`GET /api/fraud/alerts`** — Log de sinais detectados com filtros
|
|
42
|
+
- **`GET /api/fraud/blocklist`** — IPs/fingerprints atualmente bloqueados
|
|
43
|
+
- **`POST /api/fraud/blocklist/add`** — Bloquear IP ou fingerprint (via KV, efeito imediato)
|
|
44
|
+
- **`DELETE /api/fraud/blocklist/remove`** — Remover do blocklist
|
|
45
|
+
- Sinais detectados: bot_score, datacenter IP, velocity attack, email descartável, headless UA, sem Accept-Language
|
|
46
|
+
- Schema D1: `fraud_signals`, `fraud_alerts` + VIEW `v_fraud_dashboard`
|
|
47
|
+
- Agente: `fraud-detection-agent.md`
|
|
48
|
+
|
|
49
|
+
### 🔧 Fix: `wrangler.toml` atualizado
|
|
50
|
+
- Todos os placeholders (`SEU_D1_DATABASE_ID`, `SEU_KV_NAMESPACE_ID`) substituídos pelos IDs reais da conta Cloudflare
|
|
51
|
+
- D1: `7867d38f-5fa8-4c17-b465-386211422c09`
|
|
52
|
+
- KV: `821b6c1ccb4b475985439b801c1fdbe0`
|
|
53
|
+
|
|
54
|
+
---
|
|
17
55
|
|
|
18
|
-
|
|
56
|
+
## 🏗️ ARQUITETURA QUANTUM ENTERPRISE (CLOUDFLARE NATIVE)
|
|
19
57
|
|
|
20
58
|
```mermaid
|
|
21
59
|
graph TD
|
|
22
60
|
User((Usuário)) -->|Interação| SDK[cdpTrack SDK + Behavior Engine]
|
|
23
|
-
SDK -->|Edge Fetch|
|
|
24
|
-
|
|
25
|
-
|
|
61
|
+
SDK -->|Edge Fetch 1ª via KV blocklist| FraudGate{🛡️ Fraud Gate}
|
|
62
|
+
FraudGate -->|score ≥ 80: Silent Drop 200| Void[/dev/null]
|
|
63
|
+
FraudGate -->|score < 80: Permitido| Worker[Cloudflare Worker Agent]
|
|
64
|
+
Worker -->|Identity Graph + _cdp_uid| D1[(D1 SQL — 21 tabelas)]
|
|
65
|
+
Worker -->|LTV + A/B Prompt| AI[Workers AI Llama 3.1 8B]
|
|
66
|
+
Worker -->|Segmento ML| Cluster[ML Clustering Engine]
|
|
67
|
+
Cluster -->|Bid otimizado| Bidding[Bidding Recommendations]
|
|
68
|
+
Worker -->|Background| Queue[Cloudflare Queues]
|
|
26
69
|
Queue -->|Server Dispatch| Meta[Meta CAPI v22.0]
|
|
27
70
|
Queue -->|Server Dispatch| Google[GA4 / Google Ads]
|
|
28
71
|
Queue -->|Server Dispatch| TikTok[TikTok API v1.3]
|
|
29
|
-
D1 -->|
|
|
72
|
+
D1 -->|Reports| Dash[Dashboard Agent]
|
|
30
73
|
```
|
|
31
74
|
|
|
32
75
|
---
|
|
33
76
|
|
|
34
|
-
##
|
|
77
|
+
## 🧠 CATÁLOGO DE AGENTES ESPECIALISTAS
|
|
35
78
|
|
|
36
|
-
O sistema é composto por
|
|
79
|
+
O sistema é composto por **43+ agentes** coordenados pelo **Master Orchestrator**:
|
|
37
80
|
|
|
38
81
|
### 🧠 Núcleo de Inteligência
|
|
39
82
|
| Agente | Função |
|
|
40
83
|
|---|---|
|
|
41
|
-
| **Master Orchestrator** | Coordenação central
|
|
42
|
-
| **Page Analyzer** | Mapeamento automático de CTAs, Forms e
|
|
43
|
-
| **Validator Agent** | Auditoria de código, segurança e conformidade de APIs
|
|
44
|
-
| **Memory Agent** |
|
|
45
|
-
| **Intelligence Agent** | Monitoramento de
|
|
84
|
+
| **Master Orchestrator** | Coordenação central — guia todo o setup do projeto |
|
|
85
|
+
| **Page Analyzer** | Mapeamento automático de CTAs, Forms e nicho do site |
|
|
86
|
+
| **Validator Agent** | Auditoria de código, segurança e conformidade de APIs |
|
|
87
|
+
| **Memory Agent** | Contexto e checkpoints da sessão por projeto |
|
|
88
|
+
| **Intelligence Agent** | Monitoramento de versões de API (Meta v22.0+, etc) |
|
|
46
89
|
|
|
47
|
-
### 🚀
|
|
90
|
+
### 🚀 Plataformas de Anúncio
|
|
48
91
|
| Agente | Especialidade |
|
|
49
92
|
|---|---|
|
|
50
|
-
| **Meta Agent** | Facebook Pixel + CAPI
|
|
51
|
-
| **Google Agent** | GA4 + Google Ads
|
|
52
|
-
| **TikTok Agent** | TikTok Pixel + Events API v1.3
|
|
53
|
-
| **
|
|
54
|
-
| **
|
|
55
|
-
|
|
56
|
-
|
|
93
|
+
| **Meta Agent** | Facebook Pixel + CAPI v22.0 + WhatsApp CTWA |
|
|
94
|
+
| **Google Agent** | GA4 + Google Ads Enhanced Conversions |
|
|
95
|
+
| **TikTok Agent** | TikTok Pixel + Events API v1.3 |
|
|
96
|
+
| **LinkedIn Agent** | Insight Tag + Conversions API v2 |
|
|
97
|
+
| **Pinterest Agent** | Tag + Conversions API v5 |
|
|
98
|
+
| **Reddit Agent** | Pixel + Conversions API v2.0 |
|
|
99
|
+
| **Spotify Agent** | Pixel + Conversions API v1 |
|
|
100
|
+
| **Bing Agent** | UET Tag + Enhanced Conversions |
|
|
101
|
+
|
|
102
|
+
### 🤖 Enterprise Intelligence (Fase 1–4)
|
|
103
|
+
| Agente | Endpoint Principal | Impacto |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| **ML Clustering Agent** | `POST /api/segmentation/cluster` | Segmentação K-means/DBSCAN/Hierarchical |
|
|
106
|
+
| **Bidding Agent** | `POST /api/bidding/recommend` | -20% CPA via bid por segmento de LTV |
|
|
107
|
+
| **A/B LTV Agent** | `POST /api/ltv/ab-test/create` | +25% precisão LTV via test de prompts |
|
|
108
|
+
| **Fraud Detection Agent** | Auto em `/track` | Bloqueia click fraud, bots, velocity attacks |
|
|
109
|
+
|
|
110
|
+
### 🛡️ Módulos Enterprise
|
|
57
111
|
| Agente | Função |
|
|
58
112
|
|---|---|
|
|
59
|
-
| **Attribution Agent** | Atribuição Multi-Touch de alta fidelidade
|
|
60
|
-
| **Security Agent** | Rate Limiting,
|
|
61
|
-
| **Compliance Agent** |
|
|
62
|
-
| **Performance
|
|
63
|
-
| **CRM Integration** | Sincronia D1 ↔ HubSpot/Salesforce via CRM Agent. |
|
|
113
|
+
| **Attribution Agent** | Atribuição Multi-Touch de alta fidelidade |
|
|
114
|
+
| **Security Agent** | Rate Limiting, AES-256 e Bot Defense |
|
|
115
|
+
| **Compliance Agent** | LGPD e GDPR (Consent Mode v2) |
|
|
116
|
+
| **Performance Agent** | Otimização de caches e queries D1 |
|
|
64
117
|
|
|
65
118
|
---
|
|
66
119
|
|
|
67
|
-
##
|
|
68
|
-
|
|
69
|
-
### Instalar Globalmente
|
|
120
|
+
## 📊 BANCO DE DADOS D1 — 21 Tabelas
|
|
70
121
|
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
|
|
122
|
+
```
|
|
123
|
+
CORE TRACKING ML & INTELLIGENCE ENTERPRISE SECURITY
|
|
124
|
+
───────────────── ───────────────────── ─────────────────────
|
|
125
|
+
leads ml_segments fraud_signals
|
|
126
|
+
events ml_segment_members fraud_alerts
|
|
127
|
+
sessions bid_recommendations ltv_ab_tests
|
|
128
|
+
webhook_events ltv_ab_tests ltv_ab_variations
|
|
129
|
+
api_failures ltv_ab_variations ltv_ab_assignments
|
|
130
|
+
|
|
131
|
+
VIEWS
|
|
132
|
+
─────────────────────────────────────────────────
|
|
133
|
+
v_active_segments → Segmentos ML ativos com contagem de membros
|
|
134
|
+
v_active_bid_recs → Bids ativos por plataforma/vertical
|
|
135
|
+
v_ab_test_performance → Accuracy por variação de prompt
|
|
136
|
+
v_fraud_dashboard → Dashboard fraude 24h
|
|
74
137
|
```
|
|
75
138
|
|
|
76
139
|
---
|
|
77
140
|
|
|
78
|
-
##
|
|
79
|
-
|
|
80
|
-
### `install` — Instalar CDP Edge em um projeto cliente
|
|
81
|
-
|
|
82
|
-
**O comando principal.** Configura o CDP Edge em qualquer projeto e habilita o `/cdp` no Claude Code.
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Instalar no diretório atual
|
|
86
|
-
cdp-edge install .
|
|
87
|
-
|
|
88
|
-
# Instalar em outro diretório
|
|
89
|
-
cdp-edge install ./meu-projeto
|
|
90
|
-
|
|
91
|
-
# Com nome do projeto
|
|
92
|
-
cdp-edge install ./meu-projeto --name "Landing Page XYZ"
|
|
141
|
+
## 🔄 FLUXO ENTERPRISE COMPLETO
|
|
93
142
|
|
|
94
|
-
# Incluir .cursorrules para Cursor IDE
|
|
95
|
-
cdp-edge install ./meu-projeto --cursor
|
|
96
143
|
```
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
# 3. Ativar o Orchestrator
|
|
118
|
-
/cdp
|
|
144
|
+
POST /track (evento Lead)
|
|
145
|
+
│
|
|
146
|
+
├─ [1] 🛡️ Fraud Gate (KV blocklist + velocity + heurísticas) ~2ms
|
|
147
|
+
│ ├─ score < 40 → processa normalmente
|
|
148
|
+
│ ├─ score 40-79 → processa + loga suspeito (background)
|
|
149
|
+
│ └─ score ≥ 80 → silent drop 200 + loga (background)
|
|
150
|
+
│
|
|
151
|
+
├─ [2] 🔮 A/B LTV Testing — sorteia variação ativa (KV cache ~0ms)
|
|
152
|
+
│ └─ passa customSystemPrompt para predictLtv()
|
|
153
|
+
│
|
|
154
|
+
├─ [3] 🧮 LTV Prediction — Workers AI Llama 3.1 8B
|
|
155
|
+
│ └─ Score 0-100 → class High/Medium/Low → valor em BRL
|
|
156
|
+
│
|
|
157
|
+
├─ [4] 💾 D1 Writes (background via ctx.waitUntil)
|
|
158
|
+
│ ├─ upsertLtvProfile() → tabela leads
|
|
159
|
+
│ ├─ recordAbAssignment() → ltv_ab_assignments
|
|
160
|
+
│ └─ resolveDeviceGraph() → cross-device linking
|
|
161
|
+
│
|
|
162
|
+
└─ [5] 📡 CAPI dispatch (Meta + GA4 + TikTok em paralelo)
|
|
163
|
+
└─ com LTV injetado no value field
|
|
119
164
|
```
|
|
120
165
|
|
|
121
166
|
---
|
|
122
167
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
#### `setup` — Wizard interativo
|
|
126
|
-
|
|
127
|
-
```bash
|
|
128
|
-
cdp-edge setup
|
|
129
|
-
cdp-edge setup ./meu-projeto
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
**O que faz:**
|
|
133
|
-
- Pergunta plataformas (Meta, TikTok, GA4, etc.)
|
|
134
|
-
- Pergunta tipo de produto (lead, checkout, webinar, etc.)
|
|
135
|
-
- Gera código de tracking (Browser + Server)
|
|
136
|
-
- Cria schema D1 SQL e configuração Wrangler
|
|
168
|
+
## 💻 INSTALAÇÃO E USO
|
|
137
169
|
|
|
138
|
-
|
|
170
|
+
> ⚠️ **Importante:** Execute **um comando por vez** e aguarde terminar antes de rodar o próximo.
|
|
139
171
|
|
|
140
|
-
|
|
172
|
+
### Passo 1 — Instalar o CLI globalmente
|
|
141
173
|
|
|
142
174
|
```bash
|
|
143
|
-
cdp-edge
|
|
144
|
-
cdp-edge analyze ./meu-projeto
|
|
175
|
+
npm install -g cdp-edge
|
|
145
176
|
```
|
|
146
177
|
|
|
147
|
-
|
|
148
|
-
- Detecta CTAs e formulários
|
|
149
|
-
- Identifica nicho do negócio
|
|
150
|
-
- Sugere micro-eventos comportamentais
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
#### `server` — Gerar infraestrutura Cloudflare
|
|
178
|
+
### Passo 2 — Criar a pasta do projeto
|
|
155
179
|
|
|
156
180
|
```bash
|
|
157
|
-
cdp-edge
|
|
158
|
-
cdp-edge server ./meu-worker
|
|
181
|
+
cdp-edge install . --name "Nome do Projeto"
|
|
159
182
|
```
|
|
160
183
|
|
|
161
|
-
|
|
162
|
-
- `worker.js` — Cloudflare Worker completo
|
|
163
|
-
- `schema.sql` — Schema D1
|
|
164
|
-
- `wrangler.toml` — Configuração Wrangler
|
|
165
|
-
|
|
166
|
-
---
|
|
167
|
-
|
|
168
|
-
#### `validate` — Auditar tracking existente
|
|
184
|
+
### Passo 3 — Ativar no Claude Code
|
|
169
185
|
|
|
170
186
|
```bash
|
|
171
|
-
|
|
187
|
+
claude .
|
|
172
188
|
```
|
|
173
|
-
|
|
174
|
-
**O que verifica:**
|
|
175
|
-
- `event_id` para deduplicação
|
|
176
|
-
- SHA256 para PII (e-mail, telefone)
|
|
177
|
-
- Detecção de GTM/Stape
|
|
178
|
-
- Conformidade com APIs
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
#### `infra` — Guia de infraestrutura Cloudflare
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
cdp-edge infra
|
|
189
|
+
Dentro do Claude Code:
|
|
186
190
|
```
|
|
187
|
-
|
|
188
|
-
---
|
|
189
|
-
|
|
190
|
-
## 🔄 CICLO DE VIDA DO SETUP (/setup)
|
|
191
|
-
|
|
192
|
-
1. **FASE 0 — Checkpoint:** Sincronização de contexto via Memory Agent.
|
|
193
|
-
2. **FASE 1 — Análise:** Detecção automática de nicho e estrutura da página.
|
|
194
|
-
3. **FASE 2 — Mapeamento:** Identificação de CTAs, Forms e Gateways de venda.
|
|
195
|
-
4. **FASE 3 — Geração:** Código paralelo para Browser (`cdpTrack`), Worker e D1 SQL.
|
|
196
|
-
5. **FASE 4 — Auditoria:** Validação rigorosa e correções automáticas (Validator).
|
|
197
|
-
6. **FASE 5 — Deploy:** Publicação instantânea via `wrangler deploy`.
|
|
198
|
-
|
|
199
|
-
---
|
|
200
|
-
|
|
201
|
-
## 📁 ESTRUTURA DO REPOSITÓRIO
|
|
202
|
-
|
|
203
|
-
```text
|
|
204
|
-
CDP Edge/
|
|
205
|
-
├── README.md # Você está aqui.
|
|
206
|
-
├── CLAUDE.md # Guia de desenvolvimento e padrões.
|
|
207
|
-
├── extracted-skill/ # O motor da IA (Agentes e Knowledge Base).
|
|
208
|
-
│ └── tracking-events-generator/
|
|
209
|
-
│ ├── agents/ # 39+ agentes especialistas
|
|
210
|
-
│ ├── cdpTrack.js # SDK Browser (window.cdpTrack)
|
|
211
|
-
│ └── micro-events.js # Scroll, vídeo, hover, click tracking
|
|
212
|
-
├── server-edge-tracker/ # Cloudflare Worker (Infra de Borda)
|
|
213
|
-
│ ├── worker.js # Handler principal + Queue consumer
|
|
214
|
-
│ ├── schema.sql # D1 Schema (Identity Graph)
|
|
215
|
-
│ └── wrangler.toml # Bindings: D1 + Queue + KV + AI
|
|
216
|
-
├── bin/ # CLI Executável (cdp-edge)
|
|
217
|
-
├── dist/commands/ # Implementação dos comandos CLI
|
|
218
|
-
│ └── install.js # cdp-edge install
|
|
219
|
-
├── templates/
|
|
220
|
-
│ ├── install/
|
|
221
|
-
│ │ ├── CLAUDE.md # Template de auto-ativação para projetos
|
|
222
|
-
│ │ └── .claude/commands/
|
|
223
|
-
│ │ └── cdp.md # Define /cdp no Claude Code
|
|
224
|
-
│ ├── vsl-page.md # Template VSL / vídeo de vendas
|
|
225
|
-
│ └── afiliado-sem-landing.md # Template bridge page afiliado
|
|
226
|
-
└── docs/
|
|
227
|
-
├── quick-start.md # Do zero ao deploy
|
|
228
|
-
├── events-reference.md # Catálogo completo de eventos
|
|
229
|
-
├── sdk-reference.md # API pública do cdpTrack.js
|
|
230
|
-
└── installation.md # Instalar CDP Edge em projetos clientes
|
|
191
|
+
/cdp
|
|
231
192
|
```
|
|
232
193
|
|
|
233
194
|
---
|
|
234
195
|
|
|
235
|
-
##
|
|
236
|
-
|
|
237
|
-
### Cenário 1: Novo projeto com Claude Code
|
|
238
|
-
|
|
239
|
-
```bash
|
|
240
|
-
# 1. Criar projeto e instalar CDP Edge
|
|
241
|
-
mkdir landing-page-lead
|
|
242
|
-
cdp-edge install ./landing-page-lead --name "Landing Page Lead"
|
|
243
|
-
|
|
244
|
-
# 2. Abrir no Claude Code
|
|
245
|
-
claude ./landing-page-lead
|
|
246
|
-
|
|
247
|
-
# 3. Ativar o Orchestrator
|
|
248
|
-
/cdp
|
|
249
|
-
# → CDP Edge inicia, faz perguntas, gera toda a infraestrutura
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
### Cenário 2: Apenas Infraestrutura Cloudflare
|
|
196
|
+
## 🚀 DEPLOY COMPLETO (referência)
|
|
253
197
|
|
|
254
198
|
```bash
|
|
255
|
-
|
|
256
|
-
cdp-edge server ./meu-worker
|
|
199
|
+
cd server-edge-tracker
|
|
257
200
|
|
|
258
|
-
#
|
|
259
|
-
|
|
260
|
-
wrangler
|
|
201
|
+
# 1. Schemas D1 (todos em sequência)
|
|
202
|
+
wrangler d1 execute cdp-edge-db --file=schema.sql --remote
|
|
203
|
+
wrangler d1 execute cdp-edge-db --file=migrate-v6.sql --remote
|
|
204
|
+
wrangler d1 execute cdp-edge-db --file=schema-segmentation.sql --remote # Fase 1
|
|
205
|
+
wrangler d1 execute cdp-edge-db --file=schema-bidding.sql --remote # Fase 2
|
|
206
|
+
wrangler d1 execute cdp-edge-db --file=schema-ab-ltv.sql --remote # Fase 3
|
|
207
|
+
wrangler d1 execute cdp-edge-db --file=schema-fraud.sql --remote # Fase 4
|
|
261
208
|
|
|
262
|
-
#
|
|
209
|
+
# 2. Secrets
|
|
263
210
|
wrangler secret put META_ACCESS_TOKEN
|
|
211
|
+
wrangler secret put GA4_API_SECRET
|
|
264
212
|
wrangler secret put TIKTOK_ACCESS_TOKEN
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### Cenário 3: Validar Código Existente
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
cdp-edge validate tracking.js
|
|
271
|
-
|
|
272
|
-
# Status: PASS | Score: 85/100
|
|
273
|
-
# ⚠ Hashing não detectado para PII
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Cenário 4: Análise de Projeto
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
cdp-edge analyze ./meu-projeto-web
|
|
280
213
|
|
|
281
|
-
#
|
|
282
|
-
|
|
214
|
+
# 3. Deploy
|
|
215
|
+
wrangler deploy
|
|
283
216
|
```
|
|
284
217
|
|
|
285
218
|
---
|
|
286
219
|
|
|
287
|
-
##
|
|
220
|
+
## 🖱️ HUMAN-BEHAVIOR ENGINE
|
|
288
221
|
|
|
289
|
-
|
|
|
290
|
-
|
|
291
|
-
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
294
|
-
|
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
| `cdp-edge --help` | Ajuda completa |
|
|
298
|
-
| `cdp-edge --version` | Versão instalada |
|
|
222
|
+
| Evento | Pontuação |
|
|
223
|
+
|--------|-----------|
|
|
224
|
+
| Scroll 25–90% | +5 a +15 pts |
|
|
225
|
+
| VSL Watch 25–100% | +10 a +50 pts |
|
|
226
|
+
| Copy Intent (cupom, PIX) | +20 pts |
|
|
227
|
+
| Preenchimento de campo | +10 pts |
|
|
228
|
+
| Rage Click | -10 pts |
|
|
229
|
+
| **Hot Lead (80+ pts)** | **Dispara High_Intent_Lead** |
|
|
299
230
|
|
|
300
231
|
---
|
|
301
232
|
|
|
302
|
-
##
|
|
303
|
-
|
|
304
|
-
###
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
A joia da coroa do CDP Edge. Capturamos o que o usuário **sente** e **faz**, e não apenas onde ele clica.
|
|
341
|
-
|
|
342
|
-
### 🌡️ Engagement Scoring Engine (0-100)
|
|
343
|
-
Cada ação do usuário soma (ou subtrai) pontos em tempo real:
|
|
344
|
-
* **Scroll (25-90%)**: +5 a +15 pontos.
|
|
345
|
-
* **VSL Watch (25-100%)**: +10 a +50 pontos.
|
|
346
|
-
* **Copy Intent**: +20 pontos ao copiar cupons ou chaves PIX.
|
|
347
|
-
* **Form Interaction**: +10 pontos por campo preenchido.
|
|
348
|
-
* **Rage Click**: -10 pontos (sinal de frustração técnica).
|
|
349
|
-
* **Gatilho Hot Lead**: Ao atingir **80 pontos**, disparar `High_Intent_Lead` para as plataformas.
|
|
350
|
-
|
|
351
|
-
### 🎥 VSL & Video Tracker
|
|
352
|
-
Monitoramento nativo de retenção em vídeos YouTube e Vimeo sem necessidade de scripts externos pesados.
|
|
233
|
+
## 📋 TODOS OS ENDPOINTS (referência rápida)
|
|
234
|
+
|
|
235
|
+
### Core Tracking
|
|
236
|
+
| Rota | Método | Função |
|
|
237
|
+
|---|---|---|
|
|
238
|
+
| `/track` | POST | Evento principal (browser → CAPI) |
|
|
239
|
+
| `/health` | GET | Smoke test completo |
|
|
240
|
+
| `/webhook/hotmart` | POST | Webhook Hotmart Purchase |
|
|
241
|
+
| `/webhook/kiwify` | POST | Webhook Kiwify Purchase |
|
|
242
|
+
| `/webhook/ticto` | POST | Webhook Ticto Purchase |
|
|
243
|
+
|
|
244
|
+
### Intelligence ML
|
|
245
|
+
| Rota | Método | Função |
|
|
246
|
+
|---|---|---|
|
|
247
|
+
| `/api/segmentation/cluster` | POST | Clustering K-means/DBSCAN |
|
|
248
|
+
| `/api/segmentation/list` | GET | Segmentos ativos |
|
|
249
|
+
| `/api/segmentation/outliers` | GET | Outliers comportamentais |
|
|
250
|
+
| `/api/bidding/recommend` | POST | Bid otimizado por segmento |
|
|
251
|
+
| `/api/bidding/history` | GET | Histórico de bids |
|
|
252
|
+
| `/api/bidding/status` | GET | Status por plataforma |
|
|
253
|
+
|
|
254
|
+
### A/B Testing LTV
|
|
255
|
+
| Rota | Método | Função |
|
|
256
|
+
|---|---|---|
|
|
257
|
+
| `/api/ltv/ab-test/create` | POST | Criar experimento |
|
|
258
|
+
| `/api/ltv/ab-test/list` | GET | Listar experimentos |
|
|
259
|
+
| `/api/ltv/ab-test/results` | GET | Accuracy por variação |
|
|
260
|
+
| `/api/ltv/ab-test/winner` | POST | Declarar vencedor |
|
|
261
|
+
|
|
262
|
+
### Fraud Detection
|
|
263
|
+
| Rota | Método | Função |
|
|
264
|
+
|---|---|---|
|
|
265
|
+
| `/api/fraud/stats` | GET | Dashboard 24h |
|
|
266
|
+
| `/api/fraud/alerts` | GET | Log de alertas |
|
|
267
|
+
| `/api/fraud/blocklist` | GET | Lista bloqueada |
|
|
268
|
+
| `/api/fraud/blocklist/add` | POST | Bloquear IP/fingerprint |
|
|
269
|
+
| `/api/fraud/blocklist/remove` | DELETE | Desbloquear |
|
|
353
270
|
|
|
354
271
|
---
|
|
355
272
|
|
|
356
273
|
## 📞 SUPORTE
|
|
357
274
|
|
|
358
|
-
- **Documentação**: Verifique `CLAUDE.md` para padrões de desenvolvimento
|
|
359
275
|
- **Issues**: https://github.com/ricardosoli777/CDP-Edge-Premium/issues
|
|
360
276
|
- **Releases**: https://github.com/ricardosoli777/CDP-Edge-Premium/releases
|
|
361
277
|
|
|
362
278
|
---
|
|
363
279
|
|
|
364
280
|
### **CDP Edge — By Rica Soares**
|
|
365
|
-
> "Dados sem inteligência são apenas ruído. No Quantum Tier, transformamos dados em ROAS."
|
|
281
|
+
> "Dados sem inteligência são apenas ruído. No Quantum Tier Enterprise, transformamos dados em ROAS."
|
|
366
282
|
|
|
367
283
|
© 2026 CDP Edge Premium. Todos os direitos reservados.
|
package/docs/whatsapp-ctwa.md
CHANGED
|
@@ -120,7 +120,7 @@ A coluna `wamid` tem índice UNIQUE — garante que a mesma mensagem não seja p
|
|
|
120
120
|
2. Menu lateral → **WhatsApp** → **Configuration**
|
|
121
121
|
3. Seção **Webhook** → clique em **Edit**
|
|
122
122
|
4. Preencha:
|
|
123
|
-
- **Callback URL:** `https://
|
|
123
|
+
- **Callback URL:** `https://SEU_WORKER.SEU_USUARIO.workers.dev/webhook/whatsapp`
|
|
124
124
|
- **Verify Token:** valor do secret `WA_WEBHOOK_VERIFY_TOKEN`
|
|
125
125
|
5. Clique em **Verify and Save**
|
|
126
126
|
6. Após verificar, clique em **Manage** → ative o campo **`messages`**
|
|
@@ -161,7 +161,7 @@ Depois do `Contact` inicial, você pode enviar eventos adicionais conforme o lea
|
|
|
161
161
|
Exemplo de chamada para registrar uma venda fechada pelo WhatsApp:
|
|
162
162
|
|
|
163
163
|
```javascript
|
|
164
|
-
fetch('https://
|
|
164
|
+
fetch('https://SEU_WORKER.SEU_USUARIO.workers.dev/track', {
|
|
165
165
|
method: 'POST',
|
|
166
166
|
headers: { 'Content-Type': 'application/json' },
|
|
167
167
|
body: JSON.stringify({
|