2 min read

How to Measure WhatsApp Attribution and ROI with Meta Conversions API (CAPI)?

Developer guide: attribute WhatsApp sales to Meta Ads via Conversions API (CAPI) using ctwa_clid and SHA-256 hashing.

1. Why does losing attribution between ad clicks and final offline sales harm ad profitability?

When launching Click-to-WhatsApp ads, Meta's delivery algorithms optimize for the initial conversation click. Without downstream feedback, the algorithm operates blind.

Failing to report completed transactions (especially Cash on Delivery fulfillments) results in ad budgets being misallocated to low-intent conversationalists rather than genuine buyers.

2. How to extract and persist the ctwa_clid parameter from Meta's referral webhook?

When an inbound prospect originates from a paid ad, Meta injects the ctwa_clid attribute:

json
{
  "messages": [{
    "from": "212612345678",
    "id": "wamid.HBgL...",
    "referral": {
      "source_type": "ad",
      "source_id": "1202058473920102",
      "ctwa_clid": "ARBxk9_2Lp01XYZ..."
    }
  }]
}

Persist this tracking identifier alongside customer records to close the attribution loop upon transaction settlement.

3. How to report downstream conversion events back to Meta Conversions API?

When orders settle, your backend executes a server-to-server call to Meta CAPI:

  • The ctwa_clid parameter captured at lead initiation.
  • The customer's E.164 phone number, hashed using SHA-256.
  • Order financials (value, currency), accompanied by the standardized event name (Purchase).

Meta reconciles the revenue against the exact originating ad campaign, refining algorithmic bidding targeting.

4. How to analyze 30, 60, and 90-day Customer Lifetime Value (LTV) cohorts acquired via WhatsApp?

Tracking customer cohorts over 90 days highlights messaging channel retention:

Cohort HorizonAverage Revenue: Web Acquired CustomersAverage Revenue: WhatsApp Acquired Customers
Day 0 (Initial Order)$35$32
Day 30 (Reorders)+$4.50 (12% repurchase)+$18.00 (42% repurchase)
Day 60 (Cross-sell)+$2.50+$14.00
Day 90 (Consolidated LTV)$42.00$64.00 (+52% LTV uplift)

Conversational directness produces repurchase loyalty unmatched by traditional email newsletters.

5. How to implement offline purchase event dispatching to Meta CAPI in Node.js?

typescript
import crypto from 'node:crypto';

export async function sendMetaCapiPurchaseEvent({
  pixelId,
  accessToken,
  ctwaClid,
  phoneE164,
  orderId,
  amountMad
}: {
  pixelId: string;
  accessToken: string;
  ctwaClid: string;
  phoneE164: string;
  orderId: string;
  amountMad: number;
}) {
  const hashedPhone = crypto.createHash('sha256').update(phoneE164.trim()).digest('hex');

  const payload = {
    data: [{
      event_name: 'Purchase',
      event_time: Math.floor(Date.now() / 1000),
      action_source: 'business_messaging',
      event_id: orderId,
      user_data: {
        ph: [hashedPhone],
        ctwa_clid: ctwaClid
      },
      custom_data: {
        currency: 'MAD',
        value: amountMad
      }
    }]
  };

  const res = await fetch(`https://graph.facebook.com/v21.0/${pixelId}/events?access_token=${accessToken}`, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(payload)
  });

  return res.json();
}

Frequently asked questions

Is a website browser Pixel required for businesses operating solely on WhatsApp?

No. Conversions API operates purely server-to-server and reports conversion milestones without requiring website browser pixels.

How long after an ad click does the ctwa_clid remain eligible for attribution?

Meta supports attribution windows up to 7 days post-click by default (or up to 28 days depending on your Ads Manager attribution settings).

Why is SHA-256 cryptographic hashing mandatory for user data?

Meta mandates SHA-256 hashing on all personally identifiable information (phone numbers, emails) to safeguard end-user privacy during transmission.

How does CAPI reporting reduce Customer Acquisition Cost (CAC)?

Feeding real purchase data allows Meta's bidding algorithms to optimize delivery toward high-probability buyers rather than casual window shoppers.