Pay Per Click
19 minute read

How to Set Up Conversion API: A Step-by-Step Guide for Accurate Ad Tracking

Written by

Matt Pattoli

Founder at Cometly

Follow On YouTube

Published on
March 5, 2026
Get a Cometly Demo

Learn how Cometly can help you pinpoint channels driving revenue.

Loading your Live Demo...
Oops! Something went wrong while submitting the form.

Your Meta ads dashboard shows 50 conversions. Your Google Analytics shows 35. Your actual revenue tracking says 42. Which number is real? This isn't just a reporting headache—it's costing you money. When ad platforms can't see your actual conversions, their algorithms optimize toward the wrong signals, wasting budget on audiences and placements that don't actually convert.

The culprit? Browser-based tracking is breaking down. iOS privacy updates block tracking by default. Ad blockers strip pixels from loading. Cookie restrictions prevent cross-domain attribution. The result: your pixel captures maybe 60-70% of actual conversions, leaving ad platforms flying blind.

Conversion API changes the game entirely. Instead of relying on browsers to fire tracking pixels, CAPI sends conversion data directly from your server to ad platforms. No browser involvement means no iOS limitations, no ad blocker interference, no cookie restrictions. Just clean, reliable conversion data flowing exactly where it needs to go.

This matters because ad platform algorithms are only as good as the data they receive. When Meta or Google can't see 30-40% of your conversions, they can't properly optimize bidding, audience targeting, or creative delivery. You end up spending more to reach the wrong people while your best-performing segments get underfunded.

Setting up Conversion API isn't optional anymore—it's table stakes for accurate campaign optimization. This guide walks you through the complete implementation process, from generating access credentials to monitoring data quality. Whether you're implementing manually with developer resources or using a tracking platform that handles the technical complexity, you'll understand exactly how to configure server-side tracking that captures every conversion.

By the end, you'll have a working CAPI setup that feeds complete conversion data to your ad platforms, eliminates the blind spots caused by browser tracking limitations, and gives algorithms the accurate signals they need to optimize toward real business results. Let's get started.

Step 1: Gather Your Access Credentials and Platform Requirements

Before writing a single line of code or configuring any integrations, you need the right access credentials and permissions. Conversion API implementations fail most often not because of technical complexity, but because marketers skip this foundational step and hit authentication errors halfway through.

For Meta Conversion API, start in Events Manager. Navigate to Settings, then click "Generate Access Token" under the Conversions API section. This token authenticates your server's requests to Meta's API. Critical detail: the token needs ads_management permission scope. Without it, your events will be rejected even if everything else is configured perfectly.

Write down your Pixel ID while you're in Events Manager—you'll find it at the top of your pixel's overview page. This identifier tells Meta which pixel should receive your server-side events. If you're tracking multiple websites or clients, each needs its own pixel ID and corresponding access token.

Google Ads requires a different approach. You'll need to set up OAuth 2.0 credentials through Google Cloud Console, then link them to your Google Ads account. Navigate to Tools & Settings, then Conversions, and locate your conversion action ID for each conversion you want to track server-side. Unlike Meta's single pixel approach, Google requires individual conversion action IDs for purchases, leads, sign-ups, and any other conversion types.

Verify your admin access before going further. You need admin permissions on both the ad platform side and your website or server infrastructure. Conversion API setup touches multiple systems—ad accounts, tag managers, server environments, and potentially your CRM or e-commerce platform. Attempting implementation with limited permissions creates bottlenecks and delays.

Document every conversion event you want to track server-side. Be specific: "Purchase" isn't enough. Define exactly what constitutes a purchase conversion—completed checkout, payment confirmation, order confirmation page? Write down the event parameters you'll send with each conversion: purchase value, currency, product IDs, customer email. This documentation becomes your implementation blueprint and ensures consistency across pixel and server-side tracking.

One often-overlooked requirement: access to user data at the point of conversion. Server-side tracking works best when you can send user identifiers like email addresses, phone numbers, or customer IDs alongside conversion events. If your current setup doesn't capture this data during checkout or form submission, you'll need to modify those processes before implementing CAPI effectively.

Step 2: Choose Your Implementation Method

How you implement Conversion API depends on three factors: your technical resources, time constraints, and tracking complexity. Each approach has distinct tradeoffs worth understanding before you commit development time or budget.

Manual server-side implementation gives you complete control. Your developers write code that sends HTTP POST requests directly to Meta's Conversions API endpoint or Google's API. This approach makes sense when you have specific tracking requirements that pre-built solutions can't accommodate, or when you're building custom e-commerce or lead generation systems from scratch.

The reality of manual implementation: expect 2-4 weeks of development time for a basic setup, longer if you're tracking complex multi-step funnels or integrating with custom CRM systems. You'll need backend developers comfortable with API authentication, error handling, and data transformation. Ongoing maintenance becomes your responsibility—when Meta or Google updates their API specifications, your team needs to adapt the code.

Platform integrations offer a middle ground. Shopify provides native Conversion API support that you can enable with a few clicks. WooCommerce has official plugins for Meta CAPI. BigCommerce, Magento, and other major e-commerce platforms have similar native or officially-supported integrations. These handle the technical complexity while giving you control over which events to track.

The catch with platform integrations: they're typically limited to standard e-commerce events. If you're tracking custom conversion types, multi-touch attribution across channels, or events that happen outside your e-commerce platform, native integrations won't capture them. You're also dependent on the platform maintaining the integration—if they deprecate support or lag behind API updates, your tracking breaks.

Third-party tracking tools like Cometly take a different approach entirely. They sit between your website and ad platforms, automatically handling server-side event tracking across Meta, Google, TikTok, and other channels simultaneously. Instead of implementing CAPI separately for each platform, you configure tracking once and the tool manages all the server-side connections.

This approach makes sense when you're running campaigns across multiple ad platforms, don't have dedicated development resources, or want to implement quickly without technical debt. Tools like Cometly also provide additional capabilities beyond basic CAPI—multi-touch attribution, AI-powered optimization recommendations, and unified analytics across all your marketing channels. The tradeoff: monthly subscription cost instead of one-time development investment.

Evaluate based on your specific situation. Small e-commerce stores running only Meta ads might do fine with Shopify's native integration. Enterprise companies with custom tech stacks and dedicated engineering teams often prefer manual implementation for maximum flexibility. Marketing agencies managing dozens of client accounts typically choose tracking platforms to avoid maintaining separate implementations for each client.

One critical consideration regardless of method: can you deduplicate events between pixel and server-side tracking? We'll cover this in Step 4, but your implementation method needs to support sending matching event IDs from both browser and server. Not all pre-built solutions handle this correctly, leading to inflated conversion counts that make campaign analysis impossible.

Step 3: Configure Server-Side Event Tracking

Event configuration is where most implementations either excel or fail quietly. Your server can successfully send events to Meta or Google, receive 200 OK responses, and appear to work perfectly—while actually feeding ad algorithms garbage data that undermines campaign optimization.

Start by mapping your business conversions to standard event names. Meta and Google both define specific event types their algorithms recognize: Purchase, Lead, CompleteRegistration, AddToCart, InitiateCheckout. Use these exact names. When you send a custom event name like "OrderCompleted" instead of "Purchase," the ad platform receives the data but doesn't use it for campaign optimization.

Think of it this way: ad platform algorithms are trained to understand and optimize toward standard events. They know that "Purchase" events indicate completed transactions and should be weighted heavily in optimization. A custom event name is just noise—the algorithm has no context for what it means or how to factor it into bidding decisions.

Event parameters add crucial context to each conversion. For Purchase events, you need value, currency, and content_ids at minimum. Value tells the algorithm how much revenue this conversion generated—essential for value-based bidding strategies. Currency ensures proper conversion tracking across international campaigns. Content_ids identify which products were purchased, enabling product catalog optimization.

Configure additional parameters based on your business model. E-commerce stores should send content_type (product vs. product_group), content_name (product title), and num_items (quantity purchased). Lead generation businesses need predicted_ltv if you can estimate customer lifetime value, and status to indicate lead quality tiers. B2B companies tracking demo requests should include custom parameters for company size, industry, or other qualification criteria.

User data parameters dramatically improve attribution accuracy. This is where server-side tracking shows its real power—you can send user identifiers that browser-based pixels can't reliably access. The most valuable parameters: email address, phone number, first name, last name, city, state, zip code, and country.

Critical requirement: hash sensitive user data before sending. Both Meta and Google require SHA-256 hashing for email addresses and phone numbers. This protects user privacy while still enabling the ad platform to match your conversion events to specific users in their system. The hashing must happen server-side—never send plain-text email addresses or phone numbers through Conversion API.

Format matters for user parameters. Email addresses should be lowercase and trimmed of whitespace before hashing. Phone numbers need country codes and all formatting removed—just digits. If you send "+1 (555) 123-4567," it won't match. Send "15551234567" instead, then hash that normalized string.

External ID is your secret weapon for attribution accuracy. This parameter lets you send your own customer identifier—a user ID from your database, a CRM contact ID, or any unique identifier you track. When the same external_id appears across multiple conversion events, ad platforms can connect them to the same user even when email or phone data isn't available.

Set up proper event source URL tracking. This parameter tells ad platforms which webpage the conversion happened on, helping them understand conversion context and optimize accordingly. For e-commerce purchases, send your order confirmation page URL. For leads, send the thank-you page URL. This seemingly small detail improves Event Match Quality significantly.

Test your event payload before deploying to production. Both Meta and Google provide test event tools where you can send sample events and verify they're formatted correctly. Catch parameter errors, authentication issues, or malformed data structures in testing rather than discovering them weeks later when analyzing campaign performance.

Step 4: Establish Deduplication Between Pixel and API

Here's the problem: you're now sending conversion events from two sources. Your browser pixel fires when someone completes a purchase. Your server-side API sends the same purchase event. Without deduplication, ad platforms count this as two conversions instead of one, doubling your reported conversion counts and destroying the accuracy of your campaign data.

Deduplication works through matching event IDs. When both your pixel and your server-side API send the same event with identical event_id parameters, ad platforms recognize them as the same conversion and count it only once. The platform typically prioritizes the server-side event because it's more reliable than browser-based tracking.

Generate unique event IDs at the moment of conversion. This needs to happen on your server when the conversion occurs—during checkout completion, form submission, or whatever action constitutes your conversion. The event ID should be a unique string: a UUID, a timestamp-based identifier, or a hash of order details. The specific format doesn't matter as long as it's unique per conversion.

The critical step: send this same event ID to both your pixel and your server-side API call. When your server processes a purchase, it generates an event ID, sends it via Conversion API, and also passes it to your frontend code. Your pixel code then includes this event ID when it fires the browser-based Purchase event. Both events arrive at Meta or Google with matching event_id parameters, enabling deduplication.

Implementation typically looks like this: your backend generates the event ID during order processing, stores it temporarily, and returns it in the order confirmation page response. Your frontend JavaScript reads this event ID from the page and includes it in the pixel event parameters. The timing matters—both events should fire within a few seconds of each other for reliable deduplication.

Event source URL adds another deduplication signal. Configure your pixel to send the exact same event_source_url parameter that your server-side API sends. This provides a secondary matching signal beyond event ID, improving deduplication reliability when network timing issues cause events to arrive at slightly different times.

Why deduplication matters more than you think: without it, your campaign reports become meaningless. You can't calculate accurate ROAS when conversions are double-counted. You can't compare performance across campaigns when some have properly deduplicated events and others don't. You can't trust optimization algorithms that are training on inflated conversion data. Understanding the duplicate conversion counting issue is essential for maintaining data integrity.

Test deduplication before assuming it works. Send a test conversion that fires both pixel and server-side events with matching event IDs. Check your ad platform's event reporting—you should see one conversion, not two. Meta's Events Manager shows event details including whether deduplication occurred. Google Ads conversion tracking reports indicate the source of each conversion (web, API, or deduplicated).

Common deduplication failures: event IDs that don't match exactly due to character encoding issues, events that arrive more than 48 hours apart (outside the deduplication window), or pixel events that fire before the server has generated the event ID. Address these by ensuring consistent string formatting, minimizing delays between pixel and API calls, and generating event IDs before page load when possible.

Step 5: Test Your Implementation with Diagnostic Tools

Your code is deployed. Events are firing. The API returns successful responses. You're not done—you're at the most critical verification stage where small configuration errors reveal themselves before they corrupt weeks of campaign data.

Meta's Test Events tool is your first stop. In Events Manager, navigate to your pixel and click "Test Events" in the left sidebar. This tool shows real-time event data as your server sends it, displaying every parameter and highlighting errors or warnings. Send a test conversion from your staging environment and watch it appear in Test Events within seconds.

Check every parameter in the test event display. Verify your event name matches Meta's standard events exactly. Confirm value and currency parameters are formatted correctly—value should be a number, not a string, and currency should be a three-letter ISO code. Review user data parameters to ensure they're properly hashed and formatted.

Event Match Quality score appears at the top of your pixel overview in Events Manager. This score rates from 1 to 10 how well Meta can match your server events to Facebook users. Anything below 6.0 means your events lack sufficient user data for reliable attribution. Your ad optimization will suffer because Meta can't confidently connect conversions to the ads that drove them. Learn more about what is CAPI match rate and why it matters for your campaigns.

Improve Event Match Quality by adding more user parameters. If you're only sending email, add phone number and address components. If you're sending basic info, add external_id using your customer database IDs. Each additional parameter increases match rates. The goal: get as close to 8.0 or higher as possible for optimal campaign performance.

Google Ads verification happens in the Conversions section under Tools & Settings. Click on your conversion action and check the "Status" column. It should show "Recording conversions" in green. If you see warnings about low conversion volume or tracking issues, click through for specific diagnostic information. For platform-specific guidance, review our Google Conversion API implementation details.

Google's Tag Assistant is invaluable for troubleshooting. This browser extension shows you exactly what data your pixel sends and whether it matches what your server-side API sends. Use it to verify event_id matching, parameter consistency, and timing between pixel and API calls. Mismatches here explain deduplication failures.

Common errors you'll encounter: authentication failures mean your access token is invalid or lacks proper permissions—regenerate it with correct scopes. Malformed payload errors indicate JSON formatting issues or incorrect parameter types—verify your value is a number, not a string wrapped in quotes. Missing required parameters errors tell you exactly which fields to add—usually event_name, event_time, or user_data.

Rate limit errors appear when you're sending too many events too quickly. Meta allows 200 events per second per pixel. Google has similar limits. If you're processing high transaction volumes, implement batching to group multiple events into single API calls, or add retry logic with exponential backoff when you hit rate limits.

Set up monitoring for ongoing verification. Don't just test once and assume everything stays working. API endpoints change, access tokens expire, and code deployments introduce bugs. Configure alerts that notify you when event volume drops suddenly, when error rates spike, or when Event Match Quality scores decline.

The most reliable test: compare reported conversions to your source of truth. Your payment processor, CRM, or order database knows exactly how many conversions occurred. If your ad platform reports significantly different numbers (accounting for attribution windows), something is misconfigured. Track this metric weekly during the first month after implementation.

Step 6: Monitor Performance and Optimize Data Quality

Implementation is complete, events are flowing, tests pass. Now begins the ongoing optimization phase that separates effective Conversion API setups from ones that technically work but underperform. Data quality isn't a one-time achievement—it's a continuous process.

Track Event Match Quality score weekly. This single metric tells you how effectively your server events connect to actual users in ad platforms. Set a baseline when you launch, then monitor for trends. A declining score means something changed—maybe you stopped collecting email addresses at checkout, or a code deployment broke user parameter hashing.

The target: maintain 6.0 or higher consistently, with 7.0-8.0 as optimal. When you see scores drop below 6.0, investigate immediately. Check recent code changes, verify user data collection processes, and confirm hashing is working correctly. Every 0.5 point improvement in Event Match Quality translates to measurably better campaign performance.

Compare pixel-only versus CAPI conversion counts to measure improvement. Before implementing Conversion API, your pixel captured maybe 60-70% of actual conversions due to iOS limitations and ad blockers. After CAPI, you should see 20-40% more conversions reported compared to pixel-only tracking. This isn't double-counting—it's previously invisible conversions now properly attributed. Understanding the conversion API vs pixel tracking differences helps you interpret these improvements correctly.

Calculate the specific lift: take your current total conversions and compare to your historical pixel-only conversion counts during similar traffic periods. If you previously saw 100 conversions per week from pixel tracking and now see 135 total conversions with CAPI enabled, you've recovered 35% of previously lost conversion data. This recovered data directly improves ad platform optimization.

Add user parameters progressively to increase match rates. Start with email and phone if you're not sending them yet. Add first name, last name, and city next. Then include state, zip code, and country. Each additional parameter provides another matching signal, incrementally improving Event Match Quality and attribution accuracy.

The economics of better data: improving Event Match Quality from 5.0 to 7.0 typically reduces cost per acquisition by 15-25% as ad algorithms optimize toward more accurate conversion signals. The effort of collecting and sending additional user parameters pays for itself in improved campaign efficiency within weeks.

Set up alerts for API failures or event volume drops. Configure monitoring that notifies you when error rates exceed 5%, when event volume drops more than 20% day-over-day, or when access tokens approach expiration. These alerts catch issues before they impact campaign performance significantly.

Review event parameter completeness monthly. Are you sending value and currency with every Purchase event? Do Lead events include predicted_ltv when available? Are content_ids populated for product catalog campaigns? Missing parameters don't cause errors, but they limit optimization capabilities. Gradually expand parameter coverage to give ad algorithms richer signals.

Audit deduplication accuracy quarterly. Spot-check recent conversions to verify they're not double-counted. Compare total reported conversions against your order database or CRM. Investigate any discrepancies larger than 5-10%, as they indicate deduplication issues that inflate reported performance. For deeper analysis, explore duplicate conversions in analytics troubleshooting techniques.

Document changes and their impact. When you add new user parameters, note the date and track Event Match Quality changes over the following two weeks. When you modify event structures, monitor error rates and conversion counts. This documentation helps you understand what actually improves data quality versus what's just technical busy work.

Your Conversion API is Live—Now Keep It Optimized

You've built server-side tracking that captures conversions browser-based pixels miss, feeds accurate data to ad platform algorithms, and provides the foundation for reliable campaign optimization. Your quick verification checklist: access tokens are active and properly scoped, test events appear correctly in diagnostic tools with all required parameters, deduplication is working so conversions aren't double-counted, and Event Match Quality scores are 6.0 or higher.

The real value emerges over the next few weeks. As ad platforms receive more complete conversion data, their algorithms adjust bidding strategies, audience targeting, and creative delivery based on actual results instead of partial signals. You'll notice improved campaign efficiency as the systems optimize toward conversions they can now see and attribute correctly.

For marketers managing multiple ad platforms, maintaining these server-side connections manually becomes increasingly complex. Each platform has its own API specifications, authentication requirements, and parameter formats. When Meta updates their API or Google changes conversion tracking requirements, you're updating code across multiple implementations. Learning how to track conversions across multiple ad platforms becomes essential as your marketing stack grows.

Tools like Cometly handle this complexity automatically, syncing conversion data across Meta, Google, TikTok, and other platforms while providing multi-touch attribution insights that show how different channels work together. Instead of maintaining separate CAPI implementations, you configure tracking once and the platform manages all server-side connections, deduplication, and data quality optimization.

Whatever approach you choose—manual implementation, platform integrations, or tracking tools—server-side tracking is now essential infrastructure for accurate campaign optimization. The days of relying solely on browser-based pixels are over. Ad platforms need complete conversion data to deliver results, and Conversion API is how you provide it.

Ready to elevate your marketing game with precision and confidence? Discover how Cometly's AI-driven recommendations can transform your ad strategy—Get your free demo today and start capturing every touchpoint to maximize your conversions.

Get a Cometly Demo

Learn how Cometly can help you pinpoint channels driving revenue.

Loading your Live Demo...
Oops! Something went wrong while submitting the form.