cdp-edge 1.18.1 → 1.18.3
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/dist/commands/install.js +1 -1
- package/dist/commands/setup.js +1 -1
- package/extracted-skill/tracking-events-generator/agents/browser-tracking.md +2 -2
- package/extracted-skill/tracking-events-generator/agents/master-orchestrator.md +4 -4
- package/extracted-skill/tracking-events-generator/agents/premium-tracking-intelligence-agent.md +4 -4
- package/extracted-skill/tracking-events-generator/agents/server-tracking.md +8 -8
- package/extracted-skill/tracking-events-generator/agents/spotify-agent.md +1 -1
- package/extracted-skill/tracking-events-generator/agents/webhook-agent.md +4 -4
- package/extracted-skill/tracking-events-generator/agents/youtube-agent.md +3 -3
- package/package.json +1 -1
package/dist/commands/install.js
CHANGED
|
@@ -32,7 +32,7 @@ function printBanner() {
|
|
|
32
32
|
console.log(chalk.cyan('╚██████╗██████╔╝██║ ███████╗██████╔╝╚██████╔╝███████╗'));
|
|
33
33
|
console.log(chalk.cyan(' ╚═════╝╚═════╝ ╚═╝ ╚══════╝╚═════╝ ╚═════╝╚══════╝'));
|
|
34
34
|
console.log('');
|
|
35
|
-
console.log(chalk.gray(' Customer Data Platform on the Edge · Global Edge Tracking · v2.0.
|
|
35
|
+
console.log(chalk.gray(' Customer Data Platform on the Edge · Global Edge Tracking · v2.0.2'));
|
|
36
36
|
console.log('');
|
|
37
37
|
console.log(chalk.gray('═'.repeat(68)));
|
|
38
38
|
console.log('');
|
package/dist/commands/setup.js
CHANGED
|
@@ -19,7 +19,7 @@ function printBanner() {
|
|
|
19
19
|
console.log(chalk.cyan('╚██████╗██████╔╝██║ ███████╗██████╔╝╚██████╔╝███████╗'));
|
|
20
20
|
console.log(chalk.cyan(' ╚═════╝╚═════╝ ╚═╝ ╚══════╝╚═════╝ ╚═════╝╚══════╝'));
|
|
21
21
|
console.log('');
|
|
22
|
-
console.log(chalk.gray(' Customer Data Platform on the Edge · Global Edge Tracking · v2.0.
|
|
22
|
+
console.log(chalk.gray(' Customer Data Platform on the Edge · Global Edge Tracking · v2.0.2'));
|
|
23
23
|
console.log('');
|
|
24
24
|
console.log(chalk.gray('═'.repeat(68)));
|
|
25
25
|
console.log('');
|
|
@@ -33,7 +33,7 @@ Database: Cloudflare D1 (Persistência)
|
|
|
33
33
|
## 📊 FUNCIONALIDADES DO SDK
|
|
34
34
|
|
|
35
35
|
### 1. Direct Fetch
|
|
36
|
-
O rastreamento utiliza chamadas diretas via `fetch()` para o endpoint `/
|
|
36
|
+
O rastreamento utiliza chamadas diretas via `fetch()` para o endpoint `/track` no mesmo domínio.
|
|
37
37
|
|
|
38
38
|
### 2. Deduplicação
|
|
39
39
|
Gera um `event_id` único para cada evento disparado no browser para que o Worker possa bater com a CAPI.
|
|
@@ -311,7 +311,7 @@ document.getElementById('buy-btn').addEventListener('click', function() {
|
|
|
311
311
|
| Depende de | Input Esperado | O que faz com isso |
|
|
312
312
|
|-------------|----------------|------------------|
|
|
313
313
|
| **Page Analyzer** | Lista de elementos HTML | Mapeia `content_name` e `content_id` |
|
|
314
|
-
| **Server Tracking Agent** | Lista de plataformas | Adiciona endpoint Spotify `/
|
|
314
|
+
| **Server Tracking Agent** | Lista de plataformas | Adiciona endpoint Spotify `/webhook/spotify` |
|
|
315
315
|
| **Premium Tracking Intelligence** | Estratégia de tracking | Define eventos prioritários para Spotify |
|
|
316
316
|
| **Validator Agent** | Código gerado | Valida conformidade com Spotify API v1 |
|
|
317
317
|
|
|
@@ -741,7 +741,7 @@ cloudflare/
|
|
|
741
741
|
- JSON do Premium Tracking Intelligence Agent (estratégia de tracking)
|
|
742
742
|
|
|
743
743
|
**RESPONSABILIDADE:**
|
|
744
|
-
- Gerar endpoint `/
|
|
744
|
+
- Gerar endpoint `/webhook/*` (recebe webhooks de Hotmart, Kiwify, Eduzz, Ticto)
|
|
745
745
|
- Implementar Lead Lock (salvar PII no D1, vincular com fbp/fbc)
|
|
746
746
|
- Implementar despacho de Purchase via Server-Side (CAPI, Events API)
|
|
747
747
|
- Implementar Advanced Matching Máximo (email, phone, city, state) via checkout data
|
|
@@ -751,9 +751,9 @@ cloudflare/
|
|
|
751
751
|
```
|
|
752
752
|
cloudflare/
|
|
753
753
|
└── webhooks/
|
|
754
|
-
├── hotmart-webhook.js ← Rota /
|
|
755
|
-
├── kiwify-webhook.js ← Rota /
|
|
756
|
-
├── eduzz-webhook.js ← Rota /
|
|
754
|
+
├── hotmart-webhook.js ← Rota /webhook/hotmart
|
|
755
|
+
├── kiwify-webhook.js ← Rota /webhook/kiwify
|
|
756
|
+
├── eduzz-webhook.js ← Rota /webhook/eduzz
|
|
757
757
|
└── ticto-webhook.js ← Rota /webhook/ticto (HMAC-SHA256 X-Ticto-Signature)
|
|
758
758
|
```
|
|
759
759
|
|
package/extracted-skill/tracking-events-generator/agents/premium-tracking-intelligence-agent.md
CHANGED
|
@@ -553,7 +553,7 @@ function detectAdBlock() {
|
|
|
553
553
|
function handleAdBlockFallback(eventData) {
|
|
554
554
|
if (detectAdBlock()) {
|
|
555
555
|
// AdBlock ativo: enviar via servidor (não pode usar scripts de terceiros)
|
|
556
|
-
fetch('/
|
|
556
|
+
fetch('/track', {
|
|
557
557
|
method: 'POST',
|
|
558
558
|
headers: { 'Content-Type': 'application/json' },
|
|
559
559
|
body: JSON.stringify({
|
|
@@ -619,9 +619,9 @@ function getSessionId() {
|
|
|
619
619
|
```javascript
|
|
620
620
|
/**
|
|
621
621
|
* Endpoint de Tracking no Mesmo Domínio
|
|
622
|
-
* URL: https://meusite.com/
|
|
622
|
+
* URL: https://meusite.com/track (NÃO third-party)
|
|
623
623
|
*/
|
|
624
|
-
const TRACKING_ENDPOINT = '/
|
|
624
|
+
const TRACKING_ENDPOINT = '/track'; // Same-Domain Protocol
|
|
625
625
|
|
|
626
626
|
/**
|
|
627
627
|
* Enviar evento via servidor (adblock-proof)
|
|
@@ -804,7 +804,7 @@ const serverTracking = {
|
|
|
804
804
|
|
|
805
805
|
### Server Tracking (O que processar no Worker)
|
|
806
806
|
|
|
807
|
-
- [x] Receber eventos do browser (POST /
|
|
807
|
+
- [x] Receber eventos do browser (POST /track)
|
|
808
808
|
- [x] Capturar IP e geolocalização (Cloudflare headers)
|
|
809
809
|
- [x] Recuperar PII do D1 (Lead Lock)
|
|
810
810
|
- [x] Calcular Engagement Score (0.0 - 5.0)
|
|
@@ -27,7 +27,7 @@ Browser (Visitante)
|
|
|
27
27
|
▼
|
|
28
28
|
Cloudflare Edge (Worker)
|
|
29
29
|
├── Route Principal: /api/* ← Same-Domain Protocol
|
|
30
|
-
├── Route Webhook: /
|
|
30
|
+
├── Route Webhook: /webhook/* ← Rota para Gateways de Pagamento
|
|
31
31
|
├── Edge Routing (A/B) ← Interceptação via A/B Testing Agent
|
|
32
32
|
├── Edge Localization ← Manipulação de Checkout/Moeda
|
|
33
33
|
├── ML LTV Prediction ← Predição de Valor via Workers AI
|
|
@@ -812,7 +812,7 @@ context: {
|
|
|
812
812
|
### Estratégias para Maximizar Resiliência
|
|
813
813
|
|
|
814
814
|
**1. Same-Domain Endpoint:**
|
|
815
|
-
- Worker deve estar no mesmo domínio do site: `site.com/
|
|
815
|
+
- Worker deve estar no mesmo domínio do site: `site.com/track`
|
|
816
816
|
- Evita bloqueios de CORS e ad-blockers que bloqueiam requests cross-origin
|
|
817
817
|
|
|
818
818
|
**2. First-Party Cookies:**
|
|
@@ -843,9 +843,9 @@ const corsHeaders = {
|
|
|
843
843
|
- Ad-blockers podem falsificar user-agent
|
|
844
844
|
- Validação deve ser baseada em token/secret, não UA
|
|
845
845
|
|
|
846
|
-
**6.
|
|
847
|
-
-
|
|
848
|
-
-
|
|
846
|
+
**6. Same-Domain via Worker Route (anti-blocking):**
|
|
847
|
+
- Endpoint de tracking: `/track` (Worker route same-domain — ad-blockers não bloqueiam requests same-domain)
|
|
848
|
+
- A proteção real vem do same-domain, não do nome do path
|
|
849
849
|
|
|
850
850
|
---
|
|
851
851
|
|
|
@@ -1150,7 +1150,7 @@ export async function queue(batch, env) {
|
|
|
1150
1150
|
|
|
1151
1151
|
- Gerar `wrangler.toml` completo com bindings D1, KV, R2, Queues e Cron Triggers
|
|
1152
1152
|
- Gerar `schema.sql` com todas as tabelas: `events_log`, `identity_graph`, `leads`, `behavioral_events`, `webhook_events`, `user_profiles`
|
|
1153
|
-
- Gerar `worker.js` principal com endpoint `/
|
|
1153
|
+
- Gerar `worker.js` principal com endpoint `/track` (recebe eventos do browser)
|
|
1154
1154
|
- Implementar Identity Graph sync, Engagement Scoring server-side e First-Party Cookie (`_cdp_uid`)
|
|
1155
1155
|
- Implementar Anti-Blocking: CORS same-domain, headers limpos, sem keywords bloqueáveis
|
|
1156
1156
|
- Implementar sistema de retry com Cloudflare Queues (3-Tier: imediato → 5min → 15min → 45min)
|
|
@@ -1167,9 +1167,9 @@ export async function queue(batch, env) {
|
|
|
1167
1167
|
"DEPLOY.md"
|
|
1168
1168
|
],
|
|
1169
1169
|
"endpoints": {
|
|
1170
|
-
"tracking": "POST /
|
|
1170
|
+
"tracking": "POST /track",
|
|
1171
1171
|
"health": "GET /api/health",
|
|
1172
|
-
"webhooks": "POST /
|
|
1172
|
+
"webhooks": "POST /webhook/{gateway}",
|
|
1173
1173
|
"ticto": "POST /webhook/ticto"
|
|
1174
1174
|
},
|
|
1175
1175
|
"bindings_cloudflare": {
|
|
@@ -310,7 +310,7 @@ export async function hashPII(data) {
|
|
|
310
310
|
| Depende de | Input Esperado | O que faz com isso |
|
|
311
311
|
|-------------|----------------|------------------|
|
|
312
312
|
| **Page Analyzer** | Lista de elementos HTML | Mapeia `content_name` e `content_id` |
|
|
313
|
-
| **Server Tracking Agent** | Lista de plataformas | Adiciona endpoint Spotify `/
|
|
313
|
+
| **Server Tracking Agent** | Lista de plataformas | Adiciona endpoint Spotify `/webhook/spotify` |
|
|
314
314
|
| **Premium Tracking Intelligence** | Estratégia de tracking | Define eventos prioritários para Spotify |
|
|
315
315
|
| **Validator Agent** | Código gerado | Valida conformidade com Spotify API v1 |
|
|
316
316
|
|
|
@@ -65,7 +65,7 @@ async function hashWebhookUserData(webhookPayload) {
|
|
|
65
65
|
|
|
66
66
|
## 📦 ENTREGÁVEIS
|
|
67
67
|
|
|
68
|
-
1. **Route Handler**: `/
|
|
68
|
+
1. **Route Handler**: `/webhook/{gateway}` no Worker.
|
|
69
69
|
2. **D1 Query**: Lógica de atualização do perfil do usuário com o status de comprador.
|
|
70
70
|
3. **CAPI Dispatch**: Envio dos dados enriquecidos para as redes de anúncio.
|
|
71
71
|
|
|
@@ -153,10 +153,10 @@ ctx.waitUntil(Promise.allSettled([
|
|
|
153
153
|
```json
|
|
154
154
|
{
|
|
155
155
|
"rotas_geradas": {
|
|
156
|
-
"hotmart": "/
|
|
157
|
-
"kiwify": "/
|
|
156
|
+
"hotmart": "/webhook/hotmart",
|
|
157
|
+
"kiwify": "/webhook/kiwify",
|
|
158
158
|
"ticto": "/webhook/ticto",
|
|
159
|
-
"stripe": "/
|
|
159
|
+
"stripe": "/webhook/stripe"
|
|
160
160
|
},
|
|
161
161
|
"validacao_hmac": {
|
|
162
162
|
"hotmart": "X-Hotmart-Hottok",
|
|
@@ -53,7 +53,7 @@ if (consentModeVersion !== 'v2') {
|
|
|
53
53
|
|
|
54
54
|
### TrueView In-Stream (pulável após 5s)
|
|
55
55
|
- **Evento de billing**: view confirmada após 30s ou clique
|
|
56
|
-
- **Rastrear**: `video_start`, `
|
|
56
|
+
- **Rastrear**: `video_start`, `video_complete`, clique no CTA
|
|
57
57
|
- **Conversão Google Ads**: `engaged_view` (30s assistidos = 1 conversão de vídeo)
|
|
58
58
|
|
|
59
59
|
### Bumper Ads (6s não-puláveis)
|
|
@@ -505,7 +505,7 @@ if (youtubeMobileLeads.count === 0) {
|
|
|
505
505
|
|
|
506
506
|
## RESPONSABILIDADE
|
|
507
507
|
|
|
508
|
-
- Gerar eventos de progresso de vídeo (`video_start`, `
|
|
508
|
+
- Gerar eventos de progresso de vídeo (`video_start`, `video_25`, `video_50`, `video_75`, `video_complete`) via GA4
|
|
509
509
|
- Implementar YouTube IFrame API listener para rastreamento de VSL no browser
|
|
510
510
|
- Garantir `gclid`, `wbraid`, `gbraid` chegando ao Worker (nunca hashear estes campos)
|
|
511
511
|
- Persistir `ga_client_id` no D1 para cruzamento com conversões YouTube Ads
|
|
@@ -522,7 +522,7 @@ if (youtubeMobileLeads.count === 0) {
|
|
|
522
522
|
},
|
|
523
523
|
"eventos_implementados": [
|
|
524
524
|
"video_start",
|
|
525
|
-
"
|
|
525
|
+
"video_25", "video_50", "video_75",
|
|
526
526
|
"video_complete",
|
|
527
527
|
"generate_lead",
|
|
528
528
|
"purchase"
|
package/package.json
CHANGED