Meta Conversions API (CAPI) for mobile apps is a server-to-server event sharing solution that provides significant advantages for app marketers. Unlike client-side tracking, CAPI enables you to send conversion events directly from your server to Meta, ensuring higher event match quality, better control over event validation, and the ability to track important events even when your app isn't open—such as subscription renewals and refunds.
What is CAPI for Apps?
CAPI for Apps is Meta's server-to-server event sharing solution specifically designed for mobile applications. This approach offers several critical benefits:
Higher Event Match Quality: By sending events directly from your server with enriched user data, you achieve better matching rates compared to client-side tracking alone.
Control Over Event Validation: You can verify and validate events before sending them to Meta, ensuring only accurate, real-world events are tracked.
Track Events When App Isn't Open: Unlike client-side tracking, server-to-server events can capture important lifecycle events like subscription renewals, refunds, and other backend processes that occur even when users aren't actively using your app.
Prerequisites
Before implementing CAPI for your mobile app, ensure you have the following in place:
Shared Prerequisites (AEM & CAPI):
- Meta Business Manager account with admin access
- App published on App Store (iOS) or Google Play Store (Android)
- Facebook App created and live in Meta Business Manager
- Dataset created in Events Manager and linked with your Facebook App
CAPI-Specific Prerequisites:
- Access Token generated with appropriate permissions
- Server infrastructure to send events (your backend server or a service like Hardal)
Implementation Overview
Step 1: Dataset Setup
- Navigate to Events Manager → Data Sources in your Meta Business Manager
- Select your App dataset
- Verify it's linked to your Facebook App ID
- Generate Access Token from Settings → API Access
Keep your Access Token secure and never expose it in client-side code. Store it securely on your server.
Step 2: Understand Required Parameters
Every CAPI event must include specific parameters to ensure proper processing and matching. Here's what you need to know:
Core Event Parameters (Required):
event_name: Standard or custom event name (e.g., "Purchase", "Subscribe", "CompleteRegistration")event_time: Unix timestamp when the event occurredaction_source: MUST be"app"for app eventsevent_id: Required for deduplication setup (reuse UUID from client-side events)
User Data (At least one parameter required):
Meta requires at least one user data parameter per event. For best Event Match Quality and campaign performance, include as many as possible:
Recommended for iOS S2S events:
client_ip_address: User's device IP address (not your server IP)madid: IDFV (iOS) or AAID (Android) - Mobile Advertiser ID
Additional parameters to improve Event Match Quality:
em: Hashed email (SHA256)ph: Hashed phone number (SHA256)fn,ln: Hashed first and last namect,st,zp,country: Location data (city, state, zip code, country)db: Date of birth (format: YYYYMMDD)ge: Gender (m/f/n)
Custom Data (For Monetization Events):
value: Monetary amountcurrency: ISO 4217 code (e.g., "USD", "EUR")content_ids: Product identifierssubscription_id: Subscription identifierbilling_period: Billing period information
App Data (Required):
advertiser_tracking_enabled: ATT consent status (0 or 1)application_tracking_enabled: Legacy LAT status (0 or 1)extinfo: Array of app/device metadata
Step 3: Implement Server-Side Event Sending
You can implement CAPI using Meta's official SDKs or direct API calls. The implementation depends on your server infrastructure:
Option 1: Direct API Calls
Send HTTP POST requests to Meta's Conversions API endpoint with your event data.
Option 2: Meta SDKs
Use Meta's official SDKs for your server-side language (e.g., Python, Node.js, PHP).
Option 3: Server-Side Tracking Solutions
Use a server-side tracking solution like Hardal to handle CAPI implementation, event deduplication, and data enrichment automatically.
Step 4: Choose Your Event Strategy
For subscription-based apps, tracking the right events is crucial for campaign optimization. Here's a recommended event strategy:
Standard Events (Use These):
Purchase: Completed transactionSubscribe: First subscription chargeStartTrial: Trial initiatedCompleteRegistration: Account created
Custom Events (For Lifecycle Tracking):
SubscriptionRenewal: Recurring chargesSubscriptionUpgrade: User upgrades to a higher tierSubscriptionDowngrade: User downgrades to a lower tierCancelSubscription: User cancels their subscriptionRefund: Payment refundedPaywall_Viewed: Paywall impressions
Standard events are automatically recognized by Meta's algorithm and typically perform better in campaign optimization. Use custom events for specific business logic that isn't covered by standard events.
Step 5: Improve Event Match Quality
Event Match Quality (EMQ) directly impacts your campaign performance. Higher EMQ means better optimization and more accurate attribution. Here's how to maximize it:
Priority Actions:
- Strongly recommended: Add
client_ip_address(user's device IP, not your server IP) - Strongly recommended: Add
madid(IDFV for iOS, AAID for Android) - Hash and send
em(email) - Hash and send
ph(phone number)
Hashing Requirements:
When hashing user data, follow these requirements:
- Lowercase all values before hashing
- Trim whitespace from all fields
- Use SHA256 algorithm for hashing
- Remove special characters from phone numbers (keep only digits)
For detailed hashing guidelines, refer to Meta's official documentation.
Best Practices
Deduplication: Always include event_id in your CAPI events and use the same event_id from your client-side events to prevent double-counting.
Event Timing: Use the actual event occurrence time (event_time), not when the event was sent to your server.
Data Quality: Validate all user data before hashing and sending. Invalid or malformed data can reduce Event Match Quality.
Testing: Test your implementation in Meta's Events Manager Test Events tool before going live to ensure events are being received correctly.
By following this implementation guide, you can successfully set up Meta CAPI for your mobile app and unlock the benefits of server-to-server event tracking, leading to better campaign performance and more accurate attribution.