Platform Features About Learn FAQs Login Create an Account →
Conversion Tracking

CAPI Tracking for E-Commerce Brands

Server-side conversion tracking to recover lost data, improve attribution accuracy, and supercharge Smart Bidding with complete, reliable conversion signals.

15 min read Updated: April 2026 Technical Guide
Share

What is CAPI (Conversion API)?

CAPI (Conversion API) allows you to send conversion data directly from your server to Google Ads, bypassing browser-based tracking entirely. Instead of relying on JavaScript tags that can be blocked by ad blockers, restricted by browser privacy settings, or broken by iOS restrictions, you upload conversion events via the Google Ads API after the sale has completed on your server.

How It Works

When a customer completes a purchase, your server captures the GCLID (Google Click ID) that was stored at the point of ad click, then sends the conversion data — GCLID, order value, timestamp — directly to Google Ads via the API. This happens server-to-server, so ad blockers, cookie restrictions, and browser privacy settings do not affect it.

CAPI vs Client-Side Tracking

FeatureClient-Side (gtag.js)Server-Side (CAPI)
Ad blocker impactBlocked (15–30% loss)Not affected
iOS privacy (ATT)Limited by opt-outsBypassed
Cookie lifespan (Safari)7-day maximum (ITP)Server-controlled — 90+ days
Cross-device trackingLimitedBetter attribution via user identifiers
Offline / in-store salesNot possibleFully supported
Data accuracy50–70% of actual85–95%+ of actual

Conversion Types Supported

  • Click conversions — Purchases, signups, or leads that happen after an ad click (requires GCLID)
  • Call conversions — Phone orders tracked through call tracking systems
  • Store sales — In-store purchases attributed to online ad exposure
  • Enhanced conversions — Conversions enriched with first-party customer data (email, phone, address) for fallback matching

Why CAPI Matters for E-Commerce

For Google Shopping advertisers, conversion data directly impacts Smart Bidding performance. Missing conversions mean Google's algorithms make decisions on incomplete information — undervaluing your best products and misallocating budget.

25%Increase in measured conversions with CAPI
95%iOS users who opt out of tracking under ATT
30%+Desktop users running ad blockers
80%+Target match rate with enhanced conversions

The Impact on Your Campaigns

Without accurate conversion data, Smart Bidding makes systematically bad decisions. It sees a product convert at 1.2% when the true rate is 1.8%, and bids accordingly — starving profitable products of budget while overspending on visible-but-mediocre ones. Here is what this looks like in practice:

ScenarioWithout CAPIWith CAPI
Conversion visibility50–70% of actual sales85–95%+ of actual sales
Reported ROASLower than realityAccurate
iOS/Safari ordersLargely untrackedFully captured
Remarketing audiencesSmaller, incompleteFull purchaser lists
Smart Bidding qualityBased on partial dataBased on complete data

Why Accurate Data Enables Profit Optimisation

Tracking accuracy is not just a reporting problem — it directly impacts bid optimisation. When 30% of conversions are invisible to Google, Smart Bidding operates blind. Profit-based bidding tools like ProfitClarity include a tracking accuracy adjustment that compensates for known loss rates, but the foundation is always accurate server-side data. CAPI is that foundation.

2026 API Changes

Starting February 2, 2026, new developers can no longer use session attributes or raw IP address data in Google Ads API conversion imports. Google is consolidating conversion import under the Data Manager API. If you are building a new CAPI integration, target the Data Manager API from the start rather than the legacy ConversionUploadService.

Step 1: GCLID Capture & Storage

The GCLID (Google Click ID) is the critical link between an ad click and a conversion. When someone clicks your Google ad, a unique identifier is appended to the landing page URL:

https://yourdomain.com/product?gclid=EAIaIQobChMI...

Your job is to capture this parameter, persist it through the shopping journey, and store it alongside each order in your database.

Step 1a: Enable Auto-Tagging

  1. In Google Ads, go to Settings → Account Settings
  2. Enable Auto-tagging
  3. This automatically appends gclid to all ad click destination URLs

Step 1b: Capture GCLID on Your Site

Add this script to every page to capture GCLIDs from the URL and store them for later use. It also captures wbraid and gbraid — Google's iOS web and app attribution parameters:

// GCLID Capture Script — place on every page
(function() {
    const CONFIG = {
        GCLID_KEY: 'grow_gclid',
        EXPIRY_DAYS: 90
    };

    function getGclidFromUrl() {
        const params = new URLSearchParams(window.location.search);
        return params.get('gclid') ||
               params.get('wbraid') ||  // iOS web fallback
               params.get('gbraid');    // iOS app fallback
    }

    function storeGclid(gclid) {
        if (!gclid) return;

        // localStorage (primary storage)
        localStorage.setItem(CONFIG.GCLID_KEY, gclid);
        localStorage.setItem(CONFIG.GCLID_KEY + '_ts', Date.now());

        // Cookie (backup — survives localStorage clear, works cross-subdomain)
        const expires = new Date(Date.now() + CONFIG.EXPIRY_DAYS * 86400000);
        document.cookie = CONFIG.GCLID_KEY + '=' + gclid +
            ';expires=' + expires.toUTCString() +
            ';path=/;SameSite=Lax;Secure';
    }

    const gclid = getGclidFromUrl();
    if (gclid) storeGclid(gclid);
})();

Step 1c: Pass GCLID Through Checkout

Add a hidden field to your checkout form so the GCLID is submitted with the order:

<!-- Add to checkout form -->
<input type="hidden" name="gclid" id="gclid_field">
<script>
    // Populate hidden field with stored GCLID
    document.getElementById('gclid_field').value =
        localStorage.getItem('grow_gclid') || '';
</script>

Step 1d: Store GCLID in Your Database

Add GCLID columns to your orders table. Index the column for efficient lookup during upload jobs:

-- Database schema additions
ALTER TABLE orders ADD COLUMN gclid VARCHAR(255);
ALTER TABLE orders ADD COLUMN gclid_type VARCHAR(20); -- 'gclid', 'wbraid', or 'gbraid'
ALTER TABLE orders ADD COLUMN conversion_uploaded_at TIMESTAMP;
ALTER TABLE orders ADD INDEX idx_gclid (gclid);
GCLID is Case-Sensitive

Store and upload GCLIDs exactly as received — do not modify, truncate, lowercase, or trim the value. The GCLID must match Google's records character-for-character for conversion attribution to succeed. A single incorrect character means the conversion is silently rejected.

Step 2: Create Conversion Actions in Google Ads

Before uploading conversions via the API, you need a dedicated conversion action configured for offline/server-side imports. Do not use the same conversion action as your website tag — keep them separate so you can diagnose issues independently.

Create the Conversion Action

  1. In Google Ads, go to Goals → Conversions → Summary
  2. Click + New conversion action
  3. Select Import → Other data sources or CRMs
  4. Choose Track conversions from clicks
  5. Configure the settings below
SettingRecommendationNotes
Name"Server-Side Purchase" or "CAPI Purchase"Keep distinct from tag-based actions
CategoryPurchaseMatch your conversion type
ValueUse different values for each conversionPass actual order value or profit
CountEvery (for purchases)Use "One" for leads or signups
Click-through window90 daysMatch your GCLID storage duration
Attribution modelData-driven (if eligible)Falls back to last-click for new accounts

Get the Conversion Action Resource Name

After creating the action, note the Conversion Action ID from the URL or the API. You will need it in this format for upload requests:

customers/{customer_id}/conversionActions/{conversion_action_id}
Use a Separate Test Conversion Action

Create a second conversion action for development and testing. Uploading test conversions to your production action corrupts your data and can confuse Smart Bidding. Label it clearly (e.g. "CAPI Purchase — TEST") and never include it in bidding.

Step 3: Upload Conversions via the Google Ads API

With GCLIDs captured and a conversion action created, you can now upload conversions. The API endpoint is ConversionUploadService.UploadClickConversions. For new implementations from early 2026 onwards, Google recommends the Data Manager API.

API Requirements

  • Developer token — Request via your Google Ads account under Tools & Settings → API Center
  • OAuth 2.0 credentials — Service account or web app credentials from Google Cloud Console
  • Customer ID — Your Google Ads account ID without dashes (e.g. 1234567890)
  • Conversion Action resource name — From the conversion action you created

Conversion Upload Payload

Each conversion requires these fields. The order_id field is critical — it acts as an idempotency key and prevents duplicate uploads if your retry logic fires more than once for the same order:

{
    "gclid": "EAIaIQobChMI...",                            // Required — exact as captured
    "conversion_action": "customers/123/conversionActions/456",
    "conversion_date_time": "2026-03-23 14:30:00+00:00",  // ISO format with timezone
    "conversion_value": 99.99,                             // Order total OR profit value
    "currency_code": "GBP",                                // ISO 4217 currency code
    "order_id": "ORD-12345"                                // Prevents duplicate uploads
}

Upload Frequency and Batching

ParameterRecommendationReason
Batch size100–500 conversions per callBalance throughput vs API latency
Trigger methodEvent-driven on order completionMinimises latency from seconds to minutes
Fallback scheduleEvery 15 minutes for any pending queueCatches orders that missed the event trigger
Retry logicExponential backoff — 30s, 2m, 10mHandles transient API failures gracefully
Error handlingLog partial failures, mark uploaded rowsAPI can partially accept a batch
Don't Batch Daily

Uploading conversions once per day is far too slow for Smart Bidding. Google's algorithms need fresh signals to optimise bid decisions in real time. Upload within 15 minutes of order completion for maximum bidding benefit. Event-driven uploads (triggered on the order webhook or post-payment hook) are ideal.

Step 4: Enhanced Conversions for Better Match Rates

Enhanced conversions add hashed first-party customer data to your conversion uploads. When a GCLID is missing, expired, or never captured, Google can still match the conversion to an ad click by matching the customer's hashed email or phone number against signed-in Google account data.

5%Median conversion increase for Search campaigns
17%Median conversion increase for YouTube campaigns
80%+Target match rate when email + phone included
SHA-256Required hashing algorithm before upload

User Identifiers to Include

  • Email address — Most important, highest match rate. Normalise before hashing.
  • Phone number — E.164 format (+441234567890)
  • First name and last name — Lowercase, no special characters
  • Street address, city, state, postal code, country — Match to Google account billing info

Data Normalisation and Hashing

All user data must be normalised and hashed with SHA-256 before leaving your server. Google only receives the hash — never the raw data:

// Node.js — normalise and hash before upload
const crypto = require('crypto');

function hashForEnhancedConversions(value, type = 'email') {
    let normalized = value.trim().toLowerCase();

    if (type === 'email' && normalized.includes('@gmail.com')) {
        // Gmail: remove dots from the username portion
        const [username, domain] = normalized.split('@');
        normalized = username.replace(/./g, '') + '@' + domain;
    }

    if (type === 'phone') {
        // Remove all non-digit characters, then prepend country code if missing
        normalized = normalized.replace(/D/g, '');
        if (!normalized.startsWith('+')) normalized = '+' + normalized;
    }

    return crypto.createHash('sha256').update(normalized).digest('hex');
}

// Example usage
const hashedEmail = hashForEnhancedConversions('John.Doe@Gmail.com', 'email');
const hashedPhone = hashForEnhancedConversions('+44 7700 900123', 'phone');
// Include these hashes in your conversion upload payload

Multi-Layered Matching

Enhanced conversions create a fallback hierarchy so Google can attribute conversions even when your primary signal is missing:

  1. Primary match — GCLID directly links the conversion to a specific ad click
  2. Fallback match — Hashed email or phone matches to a signed-in Google account
  3. Cross-device recovery — Customer clicks on mobile, converts on desktop; email links the journey
  4. Cookie deletion recovery — GCLID cookie expired, but email match bridges the gap
Privacy and Consent Compliance

Hashing happens on your server before any data leaves. Google receives only hashes — the raw email or phone cannot be reverse-engineered. For EEA and UK users, you must also pass consent signals (ad_user_data: GRANTED) in your upload payload per Consent Mode v2 requirements. Do not upload enhanced conversion data for users who have not consented to ad personalisation.

Best Practices

Data Quality Checklist

  • Unique order IDs — Always include order_id to prevent duplicate conversions on retries
  • Accurate values — Use actual order totals or actual profit — never placeholder or average values
  • Correct timestamps — Always include timezone offset (e.g. 2026-03-23 14:30:00+00:00)
  • GCLID preserved exactly — Store and upload the value character-for-character as received
  • Multiple identifiers — Email + phone + address gives the highest match rate
  • 90-day retention — Store GCLIDs long enough to cover your full attribution window
  • Mark uploaded rows — Track conversion_uploaded_at to avoid re-uploading

Profit-Based Conversion Values

Most brands upload order revenue as the conversion value. Smart Bidding then optimises for revenue — treating a £10 profit sale the same as a £60 profit sale. This is a fundamental misalignment between what you tell Google to optimise for and what actually matters to your business.

MarginStack solves this by computing true per-order profit (after COGS, shipping, payment fees, return costs, and platform fees) and passing that value as the conversion value in the CAPI upload. Google's algorithms then optimise for actual profit, naturally bidding higher on high-margin products and pulling back on low-margin ones.

ApproachConversion Value UploadedWhat Google Optimises For
Revenue-based (standard)£99.99 (order total)Maximum revenue — margin-blind
Profit-based (MarginStack)£35.00 (actual profit)Maximum profit — favours high-margin SKUs

Layer CAPI with Tag Gateway

CAPI and Tag Gateway are complementary, not alternatives. Together they give you the most complete tracking picture possible:

LayerWhat It DoesCoverage
Tag GatewayFirst-party script proxy, bypasses browser ad blockers~85–95% of browsing sessions
CAPIServer-side upload of completed sales100% of orders placed
Enhanced ConversionsHashed user data fallback matchingAdds 5–17% attribution on top

Monitoring & Diagnostics

CAPI is not a set-and-forget system. Monitor these metrics weekly to catch issues before they affect campaign performance.

Key Metrics to Track

MetricHealthy TargetAction if Below Target
GCLID capture rate40–60% of ordersCheck script placement, verify auto-tagging is on
Upload success rate95%+ of attempted uploadsCheck GCLID validity, timestamp format, API auth
Enhanced conversion match rate80%+Add more user identifiers, check normalisation logic
Data freshness<15 minutes after orderSwitch from scheduled batches to event-driven uploads
Duplicate conversion rate<1%Ensure order_id is always included, check retry logic

Google Ads Diagnostics

  1. Go to Goals → Conversions → Summary in Google Ads
  2. Click your CAPI conversion action
  3. Open the Diagnostics tab
  4. Review: upload status, error breakdown, match rate for enhanced conversions, and recommended improvements
Compare CAPI vs CRM Totals Monthly

Run a monthly reconciliation: compare conversions recorded in Google Ads against orders in your CRM or order management system for the same date range. A large gap (more than 15%) indicates a capture or upload issue. Small gaps (5–10%) are normal due to attribution windows and non-Google traffic.

Implementation Roadmap

A practical 8-week timeline for getting CAPI live and fully optimised:

PhaseTasksOutcome
Weeks 1–2: Foundation Enable auto-tagging; deploy GCLID capture script; add database columns; test GCLID flows through checkout GCLIDs stored on new orders
Weeks 3–4: API Integration Request developer token; set up OAuth 2.0; build conversion upload service; test with 10–20 conversions First successful API uploads
Weeks 5–6: Enhanced Conversions Capture first-party data at checkout; implement normalisation and SHA-256 hashing; add to upload payload; monitor match rate 80%+ match rate in diagnostics
Weeks 7–8: Optimisation Switch to event-driven uploads; set up monitoring alerts; implement profit-based conversion values; verify Smart Bidding improvement Full system live, measurable improvement

Expected Results After Full Implementation

  • 15–25% increase in tracked conversions
  • 5–17% improvement in Smart Bidding performance
  • 80%+ match rate for GCLID and user identifier combinations
  • Recovery of iOS and ad-blocker blocked conversions that were previously invisible
  • Accurate ROAS reporting that reflects real business outcomes

Next Steps

CAPI is the tracking foundation that every other optimisation layer depends on. Once your server-side conversion data is flowing accurately, you can layer on profit-based bidding, SKU-level ROAS targets, and automated campaign management.

GROW Your Sales Handles This For You

The GROW Your Sales includes built-in CAPI infrastructure: GCLID capture, server-side conversion uploads, enhanced conversion hashing, and profit-based conversion value calculation via MarginStack. Instead of building and maintaining this pipeline yourself, connect your store and your conversions start flowing immediately. Create a free account to see how it works with your data.

Related Reading

Found this useful?
GROW Your

Deliver on your commitment to cut costs, improve profit margins & grow sales, with smart automation tools.

GROW is a profit-first automation layer for global e-commerce brands — turning real-time COGS and CAC data into fully automated, SKU-level advertising that can launch, rebuild, and update millions of products in minutes, helping retailers move faster than competitors while keeping every sale aligned to profit.

117 million items managed Since 2016 In over 31 countries
Ben Phelan — Founder, GROW Your Sales

Written by

Ben Phelan

Founder, GROW Growth Advisory & Technology Platform

Degree E-Commerce, 2001 (1st, BSc-Hons) Large scale paid search, Google Ads, Bing Ads, E-com Co-Founder: Price Comparison Platform, Redbrain Founder: GROW, Growth Advisory & Technology Platform Advisor, Mentor and Investor in technology businesses