Skip to content
Dericson Calari
Back to the blog
Capa do artigo: The map that mounts any conversion tracking: 4 steps and a prompt for your AI

The map that mounts any conversion tracking: 4 steps and a prompt for your AI

Map, save, listen and return: the logic that serves to WhatsApp, Lead Ads, website with CRM and checkout. With examples, real limits, and a prompt to teach your AI how to draw each conversion tracking.

Foto de Dericson Calari

Published on24 min read

This is the material of the MAPA: a guide for you to understand how to assemble the conversion tracking of any campaign and one prompt ready to paste into your AI, for her to recognize each structure, ask what is missing and draw the scheme with you.

The central idea fits into one sentence: changes the tool, changes the identifier, but the drawing is always the same. Map, save, listen, return.

Before I begin, a distinction I will use in the entire text:

  • First-party data collection is to collect and store the data in its base: where did the person come from, what it filled in, what happened after.
  • Conversion tracking is to return this data to the traffic platform, for it to learn from the result.

The first-party data collection leaves the person smart. The conversion tracking leave the platform smart. One without the other becomes a beautiful spreadsheet or blind campaign.

First-party data collection and conversion tracking they are not the same thing

First-party data collection (Your base)
Collect in the first contact
Save to your database
Let you understand the origin and the result
Conversion tracking (the platform)
Returns conversions to Meta, Google and others
Use the package assembled from the bank
Let the platform optimize with the actual result

Short answer

To assemble the conversion tracking of any campaign, you need to answer four questions, in this order:

  1. Map: what kind of campaign is this and what does the platform need to receive back to know who converted?
  2. Collect and save: what data arrives at the first contact and where they are stored, with which search key?
  3. Listen: where the moment happens when the lead qualify or purchase, and how does your integration know?
  4. Return: which package the integration assembles from the bank, to which platform it goes and in which format?

If you can answer the four for a campaign, you have the drawing of the conversion tracking. The rest is to implement and test.

The 4 steps of the map

01

1. Map

Type of campaign and data that the platform needs to receive back.

02

2. Collect and save

Identifiers and contact data saved in the bank at the first contact.

03

3. Listening

Understand the lead qualified and the purchase where they actually happen.

04

4. Return

The integration searches the bank, assembles the package and sends it to the platform.

The 4 steps in detail

1. Map

Before opening any tool, draw two columns on a sheet: campaign and What the platform needs to receive.

Each type of campaign delivers a different identifier in the click. Announcement that leads to the WhatsApp deliver one. Instant form delivers another. Site delivers parameters in the URL and cookies. Checkout delivers email and phone at the time of purchase. If you map it wrong, it will collect the wrong data and find out only later, when the event doesn't marry anyone.

The map also responds which result you want to return: lead, lead qualified, purchase with value. Each is a different conversion and happens in a different place.

2. Collect and save

The data must be stored in the first contact. The click happens once. If the identifier was not saved at that time, you cannot rebuild it months later, when the lead become a customer.

For each lead, the bank needs to have:

  • the Channel Identifiers (each in his own field, without mixing)
  • the Contact Data available (phone, e-mail, name);
  • an Search key to find this one again lead after;
  • a date of the first contact and a Origin (UTMs, announcement, form).

On what data help Meta recognize the person: the Good practices of Conversions API cite email, telephone and other data among the high quality parameters. To Click-to-WhatsApp, the Specific Guide recommends preserving and sending ctwa_clid whenever available, as it directly identifies the click. Prioritize channel-pertinent identifiers and supplement with contact data collected appropriately. This does not mean that there is a single ranking of parameters for all integrations.

Also save an internal contact ID and the relationship with each conversation, opportunity and request. A person can click on more than one ad: preserve the touchpoints with date, without overwriting the entire history by the last click. Record the original and normalized contact. International telephone needs country/DDI set; do not add +55 by assumption. Collect only the necessary and record applicable usage permissions.

3. Listening

That is the step that almost everyone forgets. Saving the data sends nothing to the platform. Someone needs it realize that the lead turned lead qualified or bought.

Listening can come from different places:

  • o CRM, when someone moves the step card;
  • o checkout or payment gateway webhook, when the purchase is approved;
  • an Talk, when the attendant writes something that his rule recognizes.

The third source is the most fragile, and I return to it in the example of the WhatsApp. Always prefer a source where the fact is registered in a structured way.

4. Return

When listening skyrockets, integration does four things:

  1. receive the warning ("lead 123 qualified," "request 456 approved");
  2. Search the bank what you kept back there, using the key;
  3. assemble the package in the format that that platform requires;
  4. Send and records the result, so as not to send twice.

That record matters. The Meta warns, in the guide of the Conversions API for messages, which does not help in the deduplication of these events and recommends that you deduplicate before sending. Keep it in the bank that the event has already been sent.

Example 1: WhatsApp (Click-to-WhatsApp) no Meta Ads

Situation: the ad takes the person straight into a conversation in the WhatsApp. Synthetic example: a clinic that schedules appointments and receives payment for Pix.

  • What to collect: the message webhook of the WhatsApp brings an object referral When the conversation comes from an advertisement. There they are ctwa_clid and source_id, in addition to source_type, source_url and headline. Save the phone and profile name as well. If you want email, a chatbot can ask.
  • Where to save: a table of leads of WhatsApp, with telephone, ctwa_clid, Ad ID, email (if any), date of first message and current step.
  • Search key: Internal ID of the lead and the conversation, linked to the normalized phone. The phone helps you locate; confirm which conversation/opportunity generated the conversion before choosing the click.
  • What to listen to: the stage in which the person turned lead qualified (scheduled consultation) and the purchase stage (confirmed payment).
  • Event: QualifiedLead for the qualification defined by the operation and Purchase for the confirmed purchase, both listed in the message guide. For purchase, send value and currency. The page of Conversions API for commercial messages List the events accepted for this channel. Check out the exact names there: Custom event name can be rejected on this channel.
  • Shipping: Requisition for a Conversions API with action_source: business_messaging and messaging_channel: whatsapp. The ctwa_clid goes in user_data, without hash, next to the identification of the account WhatsApp Business (whatsapp_business_account_id) on the documented path with click. The token needs the management permissions of the WhatsApp Business described in the guide.
  • Destination: Meta, in the data set that the integration guide indicates.

source_id and ctwa_clid They are not the same thing

  • source_id identifies a origin of the advertisement (the ad ID, when the source_type indicates advertisement). It is for you to know *what ad* brought the conversation.
  • ctwa_clid is the Click identifier generated by Meta in this announcement. Serves to return the conversion *associated with that click*.

Keep both in different fields. One replies "which ad?", the other "which click?". Not every conversation entry contains these fields. Check the payload received by your integration and explicitly treat the absence of the identifier; never invent it.

Two limits that almost no one counts

"Pix received R$ 2.000" does not prove payment. When the integration recognizes a sentence written by the attendant, it is reading a typed text. The attendant can write wrong, before compensation, at the wrong amount, or the payment can be charged afterwards. A rule per keyword like "scheduled consultation" or "Pix received" works as Demonstration trigger, not as financial proof.

In the clinic example, the rule identifies “Scheduled consultation” in an outgoing message of the attendant, confirms the scheduling in the CRM and records the qualification. Then, when reading “Pix received R$ 2.000”, can extract 2000.00 as candidate value. It confirms payment in the financial register or in the CRM reconciled and only then prepare Purchase, value 2000.00, currency BRL and the transaction ID. If the value does not hit, separate the case for review. Text extraction helps automate; it does not replace confirmation. Submit only the necessary business result, without the content of the consultation or clinical information.

Not all integration delivers what the attendant writes. Before putting together the sentence rule, test whether the attendance system exposes the output messages and identifies its author. Do not assume that a webhook of incoming messages includes everything that has been sent by the application or another tool. If this information does not arrive, listen to the change of step in the CRM or confirmation of payment.

Example 2: Instant form (Lead Ads) with CRM

Situation: the person fills out a form within Facebook or the Instagram. Synthetic example: capture of interested in a service, with commercial team using a kanban.

  • What to collect: the webhook leadgen brings one leadgen_id, not the lead complete. With it, its integration makes a second authenticated call and receives the data from the form. The recovery guide of leads describes the required process and permissions (among them leads_retrieval).
  • Where to save: a table of leads of the Meta, with the ID of the lead, the fields of the form (name, email, phone), the form and the ad when the return brings.
  • Search key: the ID of lead. Keep as text: it has 15 a 17 digits.
  • What to listen to: the change of stage in the kanban of the CRM (e.g. from "new" to "qualified" and then "sold"), via webhook or automation of the CRM.
  • Event: the stage of lead. A integration of leads of CRM describes how to represent stages of the funnel. Choose stable names and don’t change them later.
  • Shipping: Conversions API with the lead_id in user_data, following the payload specification of the integration of CRM.
  • Destination: Meta, as a result of the lead which came from the form.

Limit: the Meta guards the leads for a limited time for consultation by API. Download and save to the bank as soon as the lead enough. Who depends on seeking the lead only then, at the time of converting, you can find that it is no longer accessible.

Example 3: Website with form, CRM, Meta and Google Ads offline

Situation: the person clicks on the ad, falls on a page, fills out a form and the lead go to the CRM. The commercial team works the lead for days.

  • What to collect on the page: the click parameters of the URL and the cookies, each in his field:

- Google: gclid, gbraid and wbraid, when present; - Goal: fbclid (from the URL), cookies _fbc and _fbp when available; their values are sent as fbc and fbp; - UTMs, entry page, date and time; - e-mail and phone entered in the form; - the consent given.

  • Where to save: o CRM and/or your bank, with these fields engraved next to the lead.
  • Search key: the internal ID of the lead, with standard email and telephone in international format as support.
  • What to listen to: the change of stage in the CRM (qualified, proposal, gain).
  • Event: lead qualified and/or sale, with value and currency when it is sold.
  • Shipping to the Goal: Conversions API with e-mail and telephone with hash, more fbc and fbp without hash, according to the customer information parameters page.
  • Shipping to Google: offline conversion or conversion optimized for leads, preserving the available click-through identifiers and supplementing with standard email and phone and hash, as per the integration requirements, plus value, currency, timing of conversion and consent. Details below.
  • Destination: Meta and Google Ads, each with its own package.

fbclid It's not fbc, and gclid It's not fbc

  • fbclid is the parameter that the Meta places in the URL when someone clicks on the ad.
  • fbc is the value you Send à Conversions API. A documentation of `fbp` and `fbc` describes the format fb.{subdomainIndex}.{creationTime}.{fbclid} (creation time in milliseconds), differentiates uppercase from lowercase and says it should not be changed. If the cookie _fbc not exist, but the URL has fbclid, you ride the fbc with him. Don't manufacture fbc when there is no valid click or cookie; use the current Meta specification.
  • gclid, gbraid and wbraid are identifiers of the Google, for different measurement contexts. They never go to Meta, and Meta never go to Google.

There is no single click ID. Is There the click ID of each platform, and each one goes to his destiny. Preserving the values as they arrived, without converting into each other.

The classic path (UploadClickConversions, da Google Ads API) is Migrating to Data Manager API. A Current page of offline conversions restricts the legacy path to integrations with no eligible history and guides the new API. For new account, Start with Data Manager API, which uses destinations, events, normalization and hash of user data, validation mode (validateOnly) and asynchronous consultation of the diagnosis. Those who already have old integration should check the deadline and eligibility in the documentation and plan the migration.

A Google's help on conversions optimized for leads recommends preserving the click identifier when it exists and supplementing with the data you have collected (email, phone), with value, currency, conversion identification and consent. The fields and schemes They are not identical between the API old and the new: do not copy a payload from one to the other.

Optimized conversions to leads it’s not just “sending an email with a hash.” They require you to configure the measurement and import for this purpose, accept the applicable data terms, and verify the requirements of the tag, identifiers, and the chosen destination. Follow separately accepted shipping, processing and assignment: receiving the request does not guarantee that the conversion will be assigned.

Example 4: Sales platform (checkout) with webhook

Situation: o lead receives the checkout link, paid and the sales platform sends a webhook of approved purchase.

  • What to collect: in the first contact, the same data from the previous examples (channel identifiers, email, phone). In the checkout webhook: Order ID, status, value, currency, email and phone used in the purchase, date.
  • Where to save: the bank of lead (which already existed) another order table.
  • Search key: Preferably the internal ID of the lead/opportunity passed to checkout as a metadata. Normalized email and/or telephone are alternatives, with checking coincidences and divergent data. The order ID is for not send the same purchase twice.
  • What to listen to: the buy webhook approved. Validate the webhook subscription and status: generated order, pending Pix or unpaid billet is not purchase.
  • Event: purchase, with value and currency.
  • Shipping: Integration seeks the lead in the bank by phone or email from the checkout, you find the saved source and assemble the package with the identifier of that source: to Meta, the purchase event with the customer data; to Google, the conversion with the click identifier or with the data with hash.
  • Destination: Meta and/or Google, according to the links actually stored and the measurement configuration. A person may have touchpoints on both platforms. Send each eligible package to your destination, without manufacturing an exclusive origin or adding reports of the platforms as if they were unique sales.

Limits:

  • If you does not find the lead in the bank, do not invent attribution. Register as unknown origin.
  • The source of the click and the location of the conversion are different things. A completed checkout purchase does not become a "talk conversion" just because the lead one day he had one ctwa_clid. Choose the type of event source (action_source) as per where the conversion happened and check the rules of the corresponding guide.
  • Chargeback and refund: The conversion already sent is there. Record the change in your base and check out the adjustment or retraction mechanism in the shipping path used; do not re-send the purchase as new.

Prompt to stick to your AI

Copy the whole block. He is self-sufficient: he already brings the structures, the rules and the sources. Glue into a new conversation and answer the questions she asks.

Prompt · 64 lines
Você é um arquiteto de trackeamento de campanhas de tráfego pago. Vou te descrever uma campanha e você vai me ajudar a desenhar o sistema, sem escrever código antes de eu confirmar o desenho.

DEFINIÇÕES (use sempre assim)
- Rastreamento: coletar e guardar, no meu banco, os dados do lead (origem, identificadores, contato, o que aconteceu depois).
- Trackeamento: devolver conversões (lead, lead qualificado, compra com valor) à plataforma de tráfego, a partir desses dados.

LÓGICA UNIVERSAL (4 passos, para qualquer estrutura)
1. MAPEAR: tipo de campanha -> quais dados a plataforma precisa receber de volta.
2. COLETAR E GUARDAR: salvar no banco, no primeiro contato, os identificadores do canal (cada um em campo próprio), contato, UTMs, data e consentimento, com uma chave de busca.
3. ESCUTAR: detectar onde o lead qualifica ou compra (CRM, webhook de checkout/gateway, conversa).
4. DEVOLVER: a integração recebe o aviso, busca no banco pela chave, monta o pacote no formato da plataforma, envia, e registra o envio para não duplicar.

SEU PROCESSO
A) Pergunte, uma pergunta por vez: qual plataforma de anúncio? qual o destino do clique (WhatsApp, formulário instantâneo, site, checkout)? onde o lead é trabalhado (CRM, atendimento no WhatsApp, planilha)? onde a venda é confirmada (gateway, CRM, conversa)? quais ferramentas (n8n, banco, CRM)?
B) Identifique qual das 4 estruturas abaixo se aplica (pode ser mais de uma).
C) Liste os parâmetros a coletar, o banco (campos), a chave de busca, o que escutar, o evento, o envio e o destino.
D) Desenhe o esquema em texto: coleta -> banco -> escuta -> pacote -> plataforma.
E) Aponte os limites e riscos da estrutura.
F) Aponte a documentação oficial correspondente (links abaixo) e peça que eu confira a versão vigente antes de implementar. Se você não conseguir abrir uma página, diga que NÃO verificou. Não invente nome de campo, evento ou versão de API: se não tiver certeza, marque como "conferir na documentação".

ESTRUTURA 1: WhatsApp (Click-to-WhatsApp) no Meta Ads
- Coletar: do webhook de mensagem, o objeto referral: ctwa_clid (identificador do clique) e source_id (origem do anúncio; é o ID do anúncio quando source_type indica anúncio). São campos DIFERENTES. Também telefone e nome de perfil. E-mail só se eu pedir por chatbot.
- Banco: leads, conversas e pontos de contato com data. Chave: ID interno do lead/conversa, associado ao telefone normalizado com DDI confirmado. Não escolha um clique apenas porque o telefone coincide.
- Escutar: etapa no CRM ou confirmação de pagamento. Exemplo: "consulta agendada" sinaliza qualificação; "Pix recebido R$ 2.000" permite extrair 2000.00 como valor candidato. Confirme o agendamento/pagamento e valor no registro estruturado antes de enviar QualifiedLead ou Purchase com currency BRL. Texto digitado NÃO comprova pagamento.
- Limite: verificar se a integração expõe as mensagens de saída e identifica seu autor. Se não, usar evento do CRM/pagamento. Verificar se referral e ctwa_clid estão realmente presentes; não inventar valores ausentes.
- Enviar: Conversions API para mensagens comerciais com action_source business_messaging e messaging_channel whatsapp; no caminho com clique, ctwa_clid e whatsapp_business_account_id em user_data, sem hash no ctwa_clid; QualifiedLead ou Purchase conforme o fato; valor e moeda na compra; deduplicação feita por mim.
- Docs: https://developers.facebook.com/documentation/ads-commerce/conversions-api/business-messaging ; https://developers.facebook.com/documentation/ads-commerce/conversions-api/business-messaging

ESTRUTURA 2: Formulário instantâneo (Lead Ads) da Meta + CRM
- Coletar: o webhook leadgen traz leadgen_id; uma segunda chamada autenticada (permissão leads_retrieval) busca os dados do formulário. Salvar o lead no banco assim que chegar.
- Chave: ID do lead (texto, 15 a 17 dígitos).
- Escutar: mudança de etapa no kanban do CRM.
- Enviar: Conversions API com lead_id em user_data, conforme a integração de leads de CRM; nomes de estágio estáveis.
- Docs: https://developers.facebook.com/documentation/ads-commerce/marketing-api/guides/lead-ads/retrieving ; https://developers.facebook.com/documentation/ads-commerce/conversions-api/conversion-leads-integration

ESTRUTURA 3: Site com formulário -> CRM -> Meta e Google Ads
- Coletar: gclid, gbraid, wbraid (Google, cada um em campo próprio); fbclid (parâmetro da URL), cookies _fbc e _fbp (enviados como fbc e fbp); se houver fbclid real e não houver _fbc, consultar a formatação oficial de fbc, com creationTime em milissegundos, sem inventar um clique; preservar maiúsculas/minúsculas desses valores; UTMs; e-mail; telefone; consentimento. fbclid e fbc NÃO são a mesma coisa. Nunca enviar o ID de uma plataforma para a outra e nunca tratar todos os IDs de clique como um só.
- Chave: ID do lead + e-mail normalizado + telefone em formato internacional.
- Escutar: etapa no CRM.
- Enviar à Meta: Conversions API; e-mail e telefone com hash SHA-256 após normalização; fbc, fbp, IP e user agent SEM hash.
- Enviar ao Google: conversão offline / conversão otimizada para leads. A importação via Google Ads API (UploadClickConversions) está sendo migrada para a Data Manager API; para integração nova, usar a Data Manager API. Conferir elegibilidade e prazo antes de implementar. Campos diferem entre as duas APIs.
- Docs Meta: https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/customer-information-parameters ; https://developers.facebook.com/documentation/ads-commerce/conversions-api/parameters/fbp-and-fbc
- Docs Google: https://developers.google.com/data-manager/api/devguides/events/google-ads/offline ; https://developers.google.com/google-ads/api/docs/conversions/upload-offline ; https://support.google.com/google-ads/answer/11021502

ESTRUTURA 4: Plataforma de venda / checkout com webhook
- Coletar no primeiro contato os identificadores do canal; no webhook, ID do pedido, status, valor, moeda, e-mail, telefone, data.
- Chave: ID interno do lead/oportunidade em metadado do checkout, se disponível; e-mail/telefone normalizados como alternativa, com checagem de ambiguidades; ID do pedido para idempotência.
- Escutar: webhook de compra APROVADA (validar assinatura e status; pedido gerado ou Pix pendente não é compra).
- Enviar: buscar o lead no banco, achar a origem, e enviar a compra com valor ao destino correspondente (Meta e/ou Google conforme os vínculos válidos), cada um com seu pacote e identificadores. Se o lead não for encontrado, registrar origem desconhecida; não inventar atribuição.
- Limite: a origem do clique e o local da conversão são diferentes; escolher action_source conforme onde a conversão aconteceu.

VALIDAÇÃO OBRIGATÓRIA
- Diferencie dados ausentes, inválidos e não aplicáveis. Preserve original e normalizado, DDI explícito e histórico dos pontos de contato.
- Faça um caso sintético ponta a ponta e repita o mesmo webhook: a segunda entrega não pode gerar outra compra. Registre ID do evento/pedido, estado do envio, tentativas e erros; reenvie falhas de forma controlada.
- Deduplicação entre Pixel e CAPI precisa do mesmo event_name e event_id quando representam o mesmo evento; isso é diferente de controlar retries do webhook no meu banco.
- Confirme pré-requisitos de conversões otimizadas para leads (tag/importação, termos de dados, consentimento e identificadores exigidos). Sem clique, não prometa que só enviar um hash basta.
- Verifique diagnóstico e atribuição além do HTTP de aceite. A API pode aceitar o pacote sem atribuir a conversão.

REGRAS DE SEGURANÇA
- Use dados fictícios nos exemplos. Nunca peça nem escreva tokens, senhas ou endpoints reais.
- Não prometa atribuição perfeita nem resultado de campanha.
- Se algo depender da minha conta, plano ou ferramenta, diga o que eu devo conferir.

Comece agora perguntando qual é a minha plataforma de anúncio.

Frequently Asked Questions

Do I need to send all click identifiers to all platforms? No. No. Each platform has its own. The Meta (ctwa_clid, fbc, fbp, lead_id) go to the Meta; those of Google (gclid, gbraid, wbraid) go to Google. Keep each one in your own field and send each one to your destination.

fbclid and fbc Are they the same thing? No. No. fbclid is the parameter of the URL. fbc is the formatted value you send to the Conversions API, and includes the fbclid. If the cookie _fbc not exist, you ride the fbc from the fbclid of the URL, following the format of the documentation.

source_id and ctwa_clid Are they the same thing? No. No. source_id points out the origin of the advertisement; ctwa_clid Identify the click generated by the Meta. One says *which ad*, the other *which click*.

Are Email and Click Identifier the Most Important to Meta? Email is among the high-quality parameters cited in general good practices. In CTWA, Meta recommends sending ctwa_clid when available by directly identifying the click. This does not establish a single ranking for all channels: use the specific integration contract.

Can I let a sentence rule decide that there was purchase in the WhatsApp? It may serve as a trigger, but not as evidence. Text of attendant does not prove payment. Confirm on the gateway or CRM, and use the value of that record.

All API of the WhatsApp deliver me what the attendant wrote? No. No. It depends on how the number was integrated and the tool. Test before. If the exit messages do not arrive, listen to the CRM.

Can I use Google’s old offline conversion import? It depends on your integration. The old path is being migrated to Data Manager API and is restricted to integrations with no eligible history. For a new project, start with Data Manager API and check the eligibility in the documentation.

Does this guarantee perfect attribution? No. No. This design improves the chance of the platform recognizing who converted, but depends on the consent, the identifier existing, the correct arrival and the platform being able to marry the event. Test with a real case and check out the diagnoses.

How to check if the map has worked

Create one lead identifiable synthetic, confirm that the data has been saved and advance a step in the CRM. Check out the conversion link with the right opportunity, the actual moment of the event and the destination. Then repeat the same webhook: there must continue to be a single logical conversion. If there is a temporary error, the reshipment must reuse the original identifier.

When Pixel and CAPI report the same web event, keep event_name and event_id consistent according to the Good practices of the Meta. This complements the duplicity control in your bank; it does not replace it. Check the diagnoses of the platforms and record what was received, processed and assigned separately.

Checklist before implementing

Check before you turn on the conversion tracking

I have mapged the channel and the data that the platform needs to receive
I keep each identifier in my own field, in the first contact
I have a search key to find the lead
I listen to the CRM, the checkout or payment, not just conversation phrases
Deduplicate: each conversion comes out only once
Value and purchase come from a confirmed record
I tested a real case and read the platform diagnosis

Sources and official documentation

I dated this material in 11/11/2026. APIs and help pages change: the current version in the documentation is the one worth.

Meta

Google

In this blog

Closing

Map, save, listen, return. This is the design of any conversion tracking. No promise of perfect attribution: it is the way for the platform to receive the real result, and not just the click.

If this material helped, follow me for more content like this. The first-party data collection leaves the person smart. The conversion tracking leave the platform smart.