Package Exports
- cdp-edge
- cdp-edge/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cdp-edge) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
🚀 CDP Edge — Quantum Tracking Enterprise
Padrão Quantum Tracking: 100% Cloudflare Edge. Sem GTM. Sem Stape. Sem cookies de terceiros.
v2.5.5 — Integração EVO CRM (OAuth2) + Sync Total de Agentes (27 de Abril de 2026) 🔧
💻 INSTALAÇÃO
npx cdp-edge install
# ou
npm install -g cdp-edge
cdp-edge install . --name "Nome do Projeto"🤖 MANIFESTO: EU, CDP EDGE
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.
Quando um evento de Lead bate no endpoint /track:
- Fraud Gate: Bloqueio bots silenciosamente antes de qualquer processamento (~2ms via KV)
- Quiz Scoring Engine: Classifico as respostas do quiz com Granite 4.0 Micro —
comprador | interessado | curioso | perdido - A/B LTV Testing: Sorteio de prompt via KV Cache em ~0ms
- LTV Predictor: Machine Learning para qualificar intenção e gerar valor preditivo em BRL
- Nurture Scheduler: Agendar sequência de follow-up baseada na qualificação (background)
- CAPI Dispatch: Meta/GA4/TikTok recebem payload limpo com LTV e intention injetados
- Sales Engine: Semanalmente, calculo ROAS real por campanha e atualizo o seed de Lookalike com compradores confirmados
🏗️ ARQUITETURA QUANTUM ENTERPRISE
POST /track (QuizComplete)
│
├─ [1] 🛡️ Fraud Gate (KV blocklist + velocity) ~2ms
├─ [2] 🤖 Quiz Scoring Engine (Granite 4.0 Micro) → comprador/interessado/curioso/perdido
├─ [3] 🔮 A/B LTV Sorting (KV cache ~0ms)
├─ [4] 🧮 LTV Prediction (Granite 4.0 Micro) — intent qualificado → High LTV
├─ [5] 💾 D1 Writes background (quiz_sessions + leads + nurture_sequences)
└─ [6] 📡 CAPI paralelo (Meta v22.0 + GA4 + TikTok v1.3)
Cron semanal (Intelligence Agent):
├─ ROAS Feedback — cruza leads × purchases por campanha → bid recommendation
├─ Nurture Queue — envia D+1/D+3/D+7 para leads qualificados
├─ Lookalike Seed — compradores confirmados → Meta Custom Audience
├─ LTV Model Training — regressão logística com dados reais
└─ A/B LTV Auto-winner — declara vencedor quando amostra suficiente📊 BANCO DE DADOS D1 — 31 Tabelas + 12 VIEWs
CORE TRACKING ML & INTELLIGENCE SALES ENGINE
────────────── ───────────────────── ──────────────────
leads ml_segments roas_reports
events ml_segment_members nurture_sequences
sessions bid_recommendations lookalike_seeds
webhook_events ltv_ab_tests quiz_sessions
api_failures ltv_ab_variations
device_graph ltv_ab_assignments
user_profiles fraud_signals
intelligence_logs fraud_alerts
messaging_history match_quality_logs
automation_rules utm_mappings
edge_fingerprints
VIEWS (12)
──────────────────────────────────────────────────────────────────
v_active_segments v_active_bid_recs
v_ab_test_performance v_fraud_dashboard
v_quiz_qualification_summary v_quiz_dimension_impact
v_roas_latest v_nurture_pending
v_nurture_stats v_quiz_session_summary
v_leads_segmented v_ltv_feedback🧠 CATÁLOGO DE MÓDULOS ML
| Módulo | Arquivo | Função |
|---|---|---|
| Quiz Scoring | modules/ml/quiz.ts |
Análise dimensional automática das respostas |
| LTV Prediction | modules/ml/ltv.ts |
Score 0-100 + valor BRL via Granite + A/B test |
| Fraud Gate | modules/ml/fraud.ts |
Detecção de bots e fraude na borda |
| ML Clustering | modules/ml/segmentation.ts |
K-means vetorial com bge-m3 embeddings |
| Bidding ML | modules/ml/bidding.ts |
Recomendação de bid por segmento × plataforma |
| ROAS Feedback | modules/ml/roas.ts |
ROAS real por campanha, alimenta bidding |
| Match Quality | modules/ml/matchquality.ts |
Score de qualidade de dados para CAPI |
| Logistic | modules/ml/logistic.ts |
Regressão logística para LTV model treinável |
| Nurture Engine | modules/nurture.ts |
Sequências automáticas pós-qualificação |
🧠 CATÁLOGO DE AGENTES
| Categoria | Agente | Função |
|---|---|---|
| Orquestração | master-orchestrator.md |
Coordena todo o setup |
| Análise | page-analyzer.md |
Detecta CTAs, forms e nicho |
| Plataformas | meta-agent.md, google-agent.md, tiktok-agent.md... |
Especialistas por plataforma |
| Infra | server-tracking.md, devops-agent.md |
Arquitetura Cloudflare |
| Enterprise | ml-clustering-agent.md |
Segmentação dinâmica ML |
| Enterprise | bidding-agent.md |
Bids ML por segmento |
| Enterprise | ab-ltv-agent.md |
A/B testing de prompts LTV |
| Enterprise | fraud-detection-agent.md |
Detecção de fraude na borda |
| Infraestrutura | evo-crm-agent.md |
Roteamento de leads p/ EVO CRM (OAuth2) |
| Monitoramento | intelligence-agent.md |
Cron — ROAS, Nurture, Lookalike, LTV training |
📋 TODOS OS ENDPOINTS
Core
| Rota | Método | Função |
|---|---|---|
/track |
POST | Evento principal — Fraud Gate → Quiz Scoring → LTV → CAPI |
/health |
GET | Smoke test D1 + KV + AI |
/webhook/ticto |
POST | Purchase webhook (HMAC) |
/webhook/whatsapp |
POST | Webhook Meta WhatsApp → CRM (Evolution/EVO) |
/export/customer-match |
GET | Export leads para Google Ads |
/validate-install |
GET | Diagnóstico pós-deploy |
ML Clustering (Fase 1)
| Rota | Método | Função |
|---|---|---|
/api/segmentation/cluster |
POST | K-means vetorial (bge-m3 + Granite) |
/api/segmentation/list |
GET | Segmentos ativos |
/api/segmentation/outliers |
GET | Outliers comportamentais |
/api/segmentation/update |
PUT | Atualiza metadados |
Bidding (Fase 2)
| Rota | Método | Função |
|---|---|---|
/api/bidding/recommend |
POST | Bid por segmento × plataforma |
/api/bidding/history |
GET | Histórico de recomendações |
/api/bidding/status |
GET | Snapshot atual |
A/B LTV (Fase 3)
| Rota | Método | Função |
|---|---|---|
/api/ltv/ab-test/create |
POST | Cria experimento |
/api/ltv/ab-test/list |
GET | Lista experimentos |
/api/ltv/ab-test/results |
GET | Accuracy por variação |
/api/ltv/ab-test/winner |
POST | Declara vencedor |
Fraud (Fase 4)
| Rota | Método | Função |
|---|---|---|
/api/fraud/stats |
GET | Dashboard 24h |
/api/fraud/alerts |
GET | Log de sinais |
/api/fraud/blocklist |
GET | IPs bloqueados |
/api/fraud/blocklist/add |
POST | Bloquear |
/api/fraud/blocklist/remove |
DELETE | Desbloquear |
🚀 DEPLOY COMPLETO
cd server-edge-tracker
# Schemas D1 (ordem correta — todos idempotentes)
wrangler d1 execute cdp-edge-db --file=schema.sql --remote
wrangler d1 execute cdp-edge-db --file=migrate-v6.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-segmentation.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-bidding.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-ab-ltv.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-fraud.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-indexes.sql --remote
wrangler d1 execute cdp-edge-db --file=migrate-v7.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-ltv-feedback.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-utm.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-quiz.sql --remote
wrangler d1 execute cdp-edge-db --file=schema-sales-engine.sql --remote
# Secrets (nunca em arquivos — sempre via wrangler secret put)
wrangler secret put META_ACCESS_TOKEN
wrangler secret put GA4_API_SECRET
wrangler secret put TIKTOK_ACCESS_TOKEN
wrangler secret put EVO_CRM_BASE_URL
wrangler secret put EVO_CRM_CLIENT_ID
wrangler secret put EVO_CRM_CLIENT_SECRET
wrangler secret put EVO_CRM_INBOX_ID
# Deploy
wrangler deploy🗺️ GRAPHIFY — Navegando o Código
/graphify . # gera o mapa
/graphify query "como funciona o quiz scoring?" # exploração BFS
/graphify query "nurture engine → meta audience" # exploração DFS
/graphify path "quiz_answers" "meta capi" # menor caminhoChangelog completo → CHANGELOG.md
CDP Edge — By Rica Soares
"Dados sem inteligência são apenas ruído. No Quantum Tier Enterprise, transformamos dados em ROAS."
© 2026 CDP Edge Premium. Todos os direitos reservados.