Skip to main content

Meta Offline Conversions API (OCAPI)

Physical Store Purchase Tracking Implementation Guide

Smriti Batra avatar
Written by Smriti Batra
Updated over 5 months ago

Index

1. Overview

2. Purpose

3. Key Benefits

4. Data Submission Parameters

5. Meta OCAPI Format

6. Order ID Importance

7. Hashing Implementation

Overview

The Meta Offline Conversions API enables businesses to track in-store purchases and connect them with digital advertising efforts. This guide focuses specifically on physical store purchase tracking.

Purpose

Offline Conversions API for physical stores allows you to:

- Track in-store purchases triggered by digital ads

- Measure true advertising impact on physical retail

- Optimize marketing strategies for brick-and-mortar locations

- Create targeted audiences based on in-store conversion data

Key Benefits

1. Precise Conversion Tracking

- Connect digital ad interactions to physical store purchases

- Measure foot traffic and sales from digital campaigns

2. Advanced Marketing Insights

- Understand customer journey from digital to physical touchpoints

- Calculate return on ad spend (ROAS) for physical stores

- Improve location-based marketing strategies

Data Submission Parameters for Physical Store Purchases

Category

Attribute

Requirement

Hashing

Normalization Guidelines

Example

Order Data

Order ID

Recommended

N/A

Unique transaction identifier

STORE-2024-001

Event Name

Required

N/A

Must be "Purchase"

Purchase

Event Time

Required

N/A

Unix timestamp

1643723400

Customer Information

External ID

Optional

Recommended

Unique customer identifier

Loyalty number

Email

Highly Recommended

Required

Lowercase, trimmed

Phone Number

Recommended

Required

Include country code

16505551212

First Name

Optional

If Used

Lowercase

mary

Last Name

Optional

If Used

Lowercase

smith

Zip Code

Recommended

If Used

Lowercase, no spaces

94035

Country

Recommended

If Used

2-letter ISO code

us

Product Information

Currency

Required

N/A

3-letter ISO code

USD

Transaction Value

Required

N/A

Numeric

100.50

Product ID

Optional

N/A

Match product catalog

PROD12345

Product Quantity

Optional

N/A

Positive integer

1

Product Price

Optional

N/A

Numeric

25.99

Order ID Importance

1. Event Deduplication

- Prevents duplicate event submissions

- Ensures each transaction is counted only once

- Maintains data integrity by identifying unique transactions

2. Precision in Tracking

- Provides a unique identifier for each specific purchase

- Allows granular tracking of individual transactions

- Enables precise attribution of conversions

3. Deduplication Mechanism

- Primary deduplication method uses Order ID

- Within a 7-day window, events with identical:

- Order ID

- Event Time

- Event Name

are considered duplicate events

- Only the first event is retained

4. Business Intelligence

- Helps in tracking individual customer purchases

- Supports detailed sales analysis

- Enables reconciliation with internal systems

5. Matching Accuracy

- Improves event matching between different data sources

- Provides a consistent reference point across platforms

- Enhances overall conversion tracking reliability

Best Practices for Order ID

- Generate unique identifiers for each transaction

- Maintain consistent format across systems

- Ensure Order ID is persistent and unchanging

- Include sufficient context (e.g., store location, date)

Hashing Implementation

SHA-256 Hashing Code Snippet (Python)

import hashlib

def hash_personal_info(info_type, value):

"""
Hash personal information using SHA-256 algorithm

Args:

info_type (str): Type of personal information
value (str): Value to be hashed


Returns:

str: SHA-256 hashed value
"""

normalizations = {

'email': lambda x: x.lower().strip(),
'phone': lambda x: ''.join(filter(str.isdigit, x)),
'name': lambda x: x.lower().strip(),
'zip': lambda x: x.lower().replace('-', '').replace(' ', '')

}


normalized_value = normalizations.get(info_type, lambda x: x.lower().strip())(value)
hashed_value = hashlib.sha256(normalized_value.encode('utf-8')).hexdigest()

return hashed_value



# Example usage

print(hash_personal_info('email', '[email protected]'))
print(hash_personal_info('phone', '+1 (650) 555-1212'))
print(hash_personal_info('name', 'Mary'))
print(hash_personal_info('zip', '94035-1234'))

Version: 1.2

Last Updated: April 2024

Note: Always refer to the latest Meta documentation for most current implementation details.

Did this answer your question?