> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datalyr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrations Overview

> Connect DATALYR with your revenue platforms and ad networks

DATALYR integrates with your e-commerce platforms, payment processors, and ad networks to provide complete revenue attribution and automated conversion tracking.

## Available Integrations

### Revenue Platforms

**Shopify**
Sync orders, track revenue, and calculate profit with automatic order attribution.

* Order sync with customer attribution
* Profit tracking with COGS (cost of goods sold)
* Automatic conversion events
* Customer journey linking

**Stripe**
Track payments and subscriptions with automatic revenue attribution.

* Payment sync with customer matching
* Subscription tracking
* Automatic conversion events
* Email-based attribution linking

**Superwall**
Track mobile subscription revenue with automatic attribution from Superwall webhooks.

* Subscription lifecycle events (purchases, renewals, cancellations)
* Revenue tracking with gross and net revenue
* Email-based identity resolution
* SDK integration for pushing attribution into Superwall

**RevenueCat**
Track mobile in-app purchase and subscription revenue with automatic attribution from RevenueCat webhooks.

* Full subscription lifecycle (12 event types)
* Revenue tracking across iOS, Android, and web
* Identity resolution via subscriber attributes
* SDK integration for pushing attribution into RevenueCat

### Ad Networks

**Meta Ads (Facebook/Instagram)**
Send conversions back to Meta with CAPI (Conversions API) for improved attribution and ad optimization.

* Server-side conversion tracking
* Browser-based click ID (fbclid) attribution
* Enhanced matching with customer data
* Real-time conversion postbacks

**Google Ads**
Track conversions and send them back to Google Ads for campaign optimization.

* Conversion tracking via Google Ads API
* Click ID (gclid) attribution
* Enhanced conversions with customer data
* Offline conversion import

**TikTok Ads**
Send conversions to TikTok Events API for accurate attribution and campaign optimization.

* Server-side event tracking
* Click ID (ttclid) attribution
* Enhanced matching
* Real-time conversion sync

**OpenAI Ads**
Send conversions to OpenAI's Conversions API so their optimization algorithm can learn from real outcomes — including server-side and cross-device purchases.

* Server-side conversion tracking via `bzr.openai.com`
* Click ID (`oppref`) attribution
* 11 supported event types (`order_created`, `checkout_started`, `lead_created`, …)
* No PII by default — `oppref`-only matching

## How Integrations Work

### Revenue Attribution Flow

**1. User Clicks Ad**

```
User clicks Facebook ad on mobile
DATALYR captures: fbclid, utm_source=facebook, utm_medium=cpc
Stores in visitor profile: anon_abc123
```

**2. User Browses Site**

```
User views products, adds to cart
All events tracked with fbclid attribution
Session continues with Facebook attribution
```

**3. User Completes Purchase**

```
User checks out via Shopify/Stripe
Order created in platform
```

**4. Order Synced to DATALYR**

```
DATALYR syncs order via webhook or API
Matches order email to visitor profile
Links order to original fbclid from Day 1
```

**5. Conversion Sent to Meta**

```
DATALYR sends conversion to Meta CAPI
Includes fbclid for attribution
Meta attributes conversion to original ad
```

**Result:** Purchase attributed to correct Facebook ad, even if checkout happened days later or on different device.

## Integration Benefits

### Accurate Revenue Attribution

Connect server-side revenue data (Shopify, Stripe) with client-side tracking (Meta Pixel, Google Tag) for complete attribution:

* Recover conversions that browser pixels miss on iOS 14+
* Cross-device attribution via email matching
* Server-side conversion tracking captures conversions browser pixels can miss

### Automatic Profit Tracking

DATALYR calculates profit by syncing product costs:

* Shopify COGS (cost of goods sold) automatically synced
* Real-time profit per order
* ROAS and profit margin metrics in dashboard

### Ad Platform Optimization

Send conversions back to ad platforms for better campaign performance:

* Meta, Google, and TikTok receive server-side conversions
* Enhanced matching with customer data (email, phone, address)
* Real-time conversion events improve ad delivery

### Customer Journey Completion

Link anonymous visitors to identified customers across platforms:

* Email matching links Stripe/Shopify customers to website visitors
* Complete journey from ad click to purchase
* Cross-device attribution via user identification

## Setup Overview

### 1. Connect Integration

Navigate to Settings → Integrations and click "Connect" for your platform.

**For Revenue Platforms (Shopify, Stripe, Superwall, RevenueCat):**

* Authorize DATALYR to access your account
* Grant read permissions for orders/payments
* Grant read permissions for customer data

**For Ad Networks (Meta, Google, TikTok):**

* Connect your ad account
* Authorize DATALYR to send conversions
* Select pixel/tag for conversion tracking

### 2. Configure Sync Settings

**Revenue Platforms:**

* Select which events to sync (orders, refunds, subscriptions)
* Configure attribution matching (email, customer ID)
* Set sync frequency (real-time webhooks or scheduled)

**Ad Networks:**

* Map conversion events (purchase, signup, lead)
* Configure conversion values
* Set up enhanced matching (email, phone hashing)

### 3. Verify Integration

**Test Order/Payment:**
Create a test order or payment to verify sync:

* Check Event Stream for synced event
* Verify customer attribution is correct
* Confirm conversion sent to ad platform

**Check Dashboard:**

* Revenue appears in dashboard
* Orders attributed to correct source
* Conversions show in ad platform

## Integration Architecture

### Webhooks

Real-time event processing for instant attribution:

**Shopify:**

* Order created/updated webhooks
* Customer created webhooks
* Refund webhooks

**Stripe:**

* Payment intent succeeded
* Subscription created/updated
* Invoice paid

### API Sync

Scheduled syncs for historical data and missing events:

**Sync Frequency:**

* Shopify: Every 15 minutes
* Stripe: Every 15 minutes
* Meta Ads: Every 15 minutes
* Google Ads: Every 15 minutes
* TikTok Ads: Every 15 minutes

### Conversion Postbacks

Server-to-server conversion tracking:

**Meta CAPI:**

* Real-time conversion postbacks
* Enhanced matching with customer data
* Deduplication with browser pixel

**Google Ads API:**

* Offline conversion import
* Enhanced conversions
* Click ID attribution

**TikTok Events API:**

* Server-side event tracking
* Enhanced matching
* Deduplication with pixel

## Attribution Matching

### Email Matching

Most common method for linking platform customers to website visitors:

**How It Works:**

```
Day 1: User visits site (anonymous)
       visitor_id: anon_abc123
       fbclid: IwAR123 (captured from ad)

Day 3: User purchases via Shopify
       Order email: user@example.com

       DATALYR matches email to visitor:
       - Searches events for user@example.com
       - Finds visitor_id: anon_abc123
       - Links order to fbclid: IwAR123

Day 3: Conversion sent to Meta
       fbclid: IwAR123
       event: Purchase
       value: $99.99
```

### Customer ID Matching

For platforms with customer accounts:

**Shopify:**

* Shopify customer\_id linked to datalyr user\_id
* Orders automatically attributed to customer journey

**Stripe:**

* Stripe customer\_id linked to datalyr user\_id
* Subscriptions attributed to original signup source

### Anonymous Visitor Matching

When no email/customer ID is available:

**Fallback Methods:**

1. Browser fingerprint matching
2. Session ID matching (same browser session)
3. IP address + user agent matching (last resort)

## Data Synced

### Shopify

**Orders:**

* Order ID, order number, created date
* Total price, currency, line items
* Customer email, customer ID
* Discount codes, shipping info
* Financial status, fulfillment status

**Products:**

* Product title, SKU, vendor, type
* Cost per item (COGS)
* Price, compare at price

**Customers:**

* Email, name, phone
* Total orders, total spent
* Created date, last order date

### Stripe

**Payments:**

* Payment intent ID, amount, currency
* Customer email, customer ID
* Payment method, status
* Created date

**Subscriptions:**

* Subscription ID, plan, price
* Customer email, customer ID
* Start date, status, interval

**Customers:**

* Email, name, phone
* Stripe customer ID
* Created date

### Ad Networks

**Meta Ads:**

* Campaign, ad set, ad stats
* Spend, impressions, clicks, CPM, CPC
* Conversions (from Meta reporting)

**Google Ads:**

* Campaign, ad group stats
* Spend, impressions, clicks, conversions
* Cost per conversion

**TikTok Ads:**

* Campaign, ad group, ad stats
* Spend, impressions, clicks
* Conversions (from TikTok reporting)

## Privacy and Compliance

### Data Hashing

Customer data is hashed before sending to ad platforms:

* SHA-256 hashing for emails and phone numbers
* Compliant with Meta CAPI, Google Enhanced Conversions
* No plaintext PII sent to ad networks

### GDPR Compliance

Users can opt out of tracking:

* Opt-out respected across all integrations
* No data synced for opted-out users
* User data deletion on request

### Data Retention

Integration data is stored according to platform requirements:

* Orders/payments: Retained indefinitely for reporting
* Customer data: Retained for attribution matching
* Ad stats: Retained for 13 months (platform standard)

## Troubleshooting

**Orders Not Appearing?**

Check:

* Integration is connected and active
* Webhooks are configured (for Shopify)
* API credentials are valid (for Stripe)
* Check Event Stream for synced events

**Conversions Not Attributed?**

Verify:

* Customer email matches visitor email
* Order within attribution window (default 30 days)
* Click ID present in visitor profile
* User identified via identify() call

**Conversions Not Sent to Ad Platform?**

Ensure:

* Ad account connected and authorized
* Conversion event mapped correctly
* Click ID present in order attribution
* Check integration logs for errors

## Next Steps

<CardGroup cols={2}>
  <Card title="Shopify Integration" icon="bag-shopping" href="/integrations/shopify">
    Set up Shopify order sync and profit tracking
  </Card>

  <Card title="Stripe Integration" icon="stripe" href="/integrations/stripe">
    Connect Stripe for payment attribution
  </Card>

  <Card title="Meta Ads Integration" icon="meta" href="/integrations/meta-ads">
    Send conversions to Facebook and Instagram
  </Card>

  <Card title="Conversion Rules" icon="arrows-turn-to-dots" href="/integrations/conversion-rules">
    Configure custom conversion rules
  </Card>

  <Card title="Superwall Integration" icon="mobile" href="/integrations/superwall">
    Track mobile subscription revenue from Superwall
  </Card>

  <Card title="RevenueCat Integration" icon="mobile" href="/integrations/revenuecat">
    Track mobile subscription and purchase revenue from RevenueCat
  </Card>
</CardGroup>

## Need Help?

Questions about integrations? Check our [troubleshooting guide](/troubleshooting/integration-errors) or contact support.
