Understanding OCAPI in Salesforce Commerce Cloud
A practical guide to Offline Conversion API (OCAPI) — what it is, how it works, and how performance marketers can implement it to track in-store conversions from digital campaigns.
What is OCAPI?
OCAPI stands for Offline Conversion API — a mechanism that allows you to send offline event data (like in-store purchases, phone order completions, or CRM lead updates) back to advertising platforms such as Meta and Google, so they can attribute these conversions to the right digital campaigns.
When a customer clicks a Facebook ad and walks into a store two days later to buy a product, that purchase is traditionally invisible to your digital campaigns. OCAPI solves this attribution gap.
Why this matters: In omnichannel retail, 60–80% of digital-influenced revenue can happen offline. Without OCAPI, you are optimising campaigns with incomplete data.
How OCAPI Works
The implementation follows a three-step flow:
[Customer clicks ad] → [Store purchase / CRM event] → [API sends data back to platform]
Step 1: Capture the Click ID
When a user clicks a Meta or Google ad, a unique identifier is appended to the URL:
- Meta:
fbclidparameter - Google:
gclidparameter
You must capture and store these IDs — typically in your CRM, POS system, or a customer data platform — and associate them with each user profile.
// Example: Capturing fbclid from URL and storing in session
const urlParams = new URLSearchParams(window.location.search);
const fbclid = urlParams.get('fbclid');
if (fbclid) {
sessionStorage.setItem('fbclid', fbclid);
// Send to your backend to associate with the user profile
}
Step 2: Record the Offline Event
When the offline conversion happens (POS transaction, CRM status change, phone order), your system should log:
- The customer identifier (hashed email, phone, or the click ID)
- Event type (Purchase, Lead, CompleteRegistration)
- Event timestamp
- Event value (transaction amount)
- Currency
Step 3: Send to the API
Using Meta’s Conversions API or Google’s Enhanced Conversions API, you send this data server-to-server:
{
"event_name": "Purchase",
"event_time": 1710000000,
"user_data": {
"em": ["sha256_hashed_email"],
"ph": ["sha256_hashed_phone"],
"fbc": "fb.1.1710000000.fbclid_value"
},
"custom_data": {
"value": 4999.00,
"currency": "INR",
"order_id": "ORD-20240315-001"
}
}
Implementation in Salesforce Commerce Cloud
In Salesforce Commerce Cloud (SFCC), OCAPI can be implemented via:
- Business Manager Custom Objects — store click IDs against customer profiles
- Order Hook (
dw.order.OrderMgr) — trigger the API call on order confirmation - Cartridge Integration — build a custom cartridge to handle the API calls server-side
Key SFCC-Specific Considerations
| Concern | Solution |
|---|---|
| PII / Hashing | Hash all user data (SHA-256) before transmission |
| Order Attribution Window | Meta: 7-day click, 1-day view. Google: 30-day click |
| Duplicate Events | Use event_id to deduplicate server + pixel events |
| Testing | Use Meta’s Test Events tool and Google Tag Assistant |
Real-World Impact: Kushals Fashion Jewellery
At Kushals, implementing OCAPI for in-store walk-in tracking had a direct impact:
- 37% ROAS improvement after accurate offline attribution
- Revenue reporting gap closed — previously 40% of store revenue was unmapped to campaigns
- Campaign optimisation improved — Meta’s algorithm now learned from the full customer journey
The implementation connected our Google Merchant Center Local Inventory Ads → in-store purchase events back to the respective ad groups, allowing us to confidently allocate budget toward store walk-in campaigns.
Common Pitfalls
1. Not capturing click IDs on all entry points
Many marketers capture fbclid only on landing pages but miss direct-to-store QR codes and WhatsApp flows.
2. Hashing inconsistency Always normalise data before hashing: lowercase email, strip formatting from phone numbers, then SHA-256.
3. Event deduplication ignored If both your pixel and server-side API fire for the same event, Meta will count it twice — inflating reported conversions.
4. Delayed sends Offline conversions sent more than 7 days after the click are discounted in attribution. Build a daily sync job.
Conclusion
OCAPI is no longer optional for omnichannel brands. If your brand has both online and offline touchpoints, implementing offline conversion tracking is the single highest-ROI technical initiative you can undertake in 2024.
The data gap it closes transforms your campaigns from guessing to precision — and that precision directly translates to ROAS.
Have questions about implementing OCAPI for your brand? Reach out →