> ## 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.

# Conversion Rules

> Configure how events are sent to ad platforms with conversion rules

Conversion Rules control how DATALYR sends events to ad platforms (Meta, Google, TikTok). They map your events to platform-specific events, set conversion values, and configure when conversions are sent.

## What Are Conversion Rules

Conversion Rules are mappings that tell DATALYR:

* **Which events** to send (trigger event name)
* **Which platform** to send to (Meta, Google, TikTok)
* **What event name** to use on the platform
* **What value** to send with the conversion
* **What data** to include (customer info, products, etc.)

## How Conversion Rules Work

**Without Conversion Rule:**

```
User completes purchase
DATALYR tracks: purchase event
No conversion sent to ad platforms
```

**With Conversion Rule:**

```
User completes purchase
DATALYR tracks: purchase event

Conversion Rule matches:
- Trigger: purchase
- Platform: Meta Ads
- Event: Purchase
- Value: Order total ($99.99)

DATALYR sends to Meta CAPI:
- Event: Purchase
- Value: $99.99
- Customer data (hashed)
- Attribution: fbclid
```

**Result:** Meta receives conversion and attributes to campaign.

## Creating Conversion Rules

### 1. Navigate to Conversion Rules

1. Go to Dashboard → Settings
2. Click "Conversion Rules" tab
3. Click "Add Rule" button

### 2. Configure Basic Settings

**Rule Name:**

```
Descriptive name for your reference
Example: "Purchase to Meta"
```

**Trigger Event:**

```
Your event name that triggers the rule
Examples:
- purchase
- signup
- lead_form_submitted
- trial_started
```

**Target Platform:**

```
Select ad platform:
- Meta Ads (Facebook/Instagram)
- Google Ads
- TikTok Ads
```

**Platform Event Name:**

```
Event name on the ad platform
Meta examples: Purchase, Lead, CompleteRegistration
Google examples: Purchase, Submit lead form, Sign up
TikTok examples: CompletePayment, SubmitForm, CompleteRegistration
```

### 3. Set Conversion Value

**Dynamic Value (Recommended for purchases):**

```
Value Path: order.total_price
Result: Uses actual order value from event data

Example event:
{
  "event_name": "purchase",
  "order": {
    "total_price": 149.99
  }
}

Sends value: $149.99 to ad platform
```

**Static Value (For leads, signups):**

```
Static Value: 50
Result: Always sends $50 for this conversion

Example use cases:
- Lead value: $50
- Signup value: $100 (LTV estimate)
- Trial start: $29 (monthly plan value)
```

**No Value:**

```
Leave empty for events without monetary value
Example: Page views, video plays, downloads
```

### 4. Configure Platform Settings

**Meta Ads Settings:**

```
Pixel ID: 123456789012345
Action Source: website (or app)
Test Mode: Off (enable for testing)
```

**Google Ads Settings:**

```
Customer ID: 123-456-7890
Conversion Action ID: 123456789
Test Mode: Off
```

**TikTok Ads Settings:**

```
Pixel Code: ABC123XYZ
Event Source: web (or app)
Test Mode: Off
```

### 5. Save and Activate

Click "Save" to create the rule. The rule is active immediately and will process new events going forward.

## Event Mapping Examples

### E-commerce Store

**Purchase Event:**

```
Trigger Event: purchase
Platform: Meta Ads
Platform Event: Purchase
Value: Dynamic (order.total_price)
```

**Add to Cart:**

```
Trigger Event: add_to_cart
Platform: Meta Ads
Platform Event: AddToCart
Value: Dynamic (cart.value)
```

**Begin Checkout:**

```
Trigger Event: begin_checkout
Platform: Meta Ads
Platform Event: InitiateCheckout
Value: Dynamic (cart.total)
```

### SaaS Product

**Signup:**

```
Trigger Event: signup
Platform: Google Ads
Platform Event: Sign up
Value: Static ($100 - estimated LTV)
```

**Trial Started:**

```
Trigger Event: trial_started
Platform: Meta Ads
Platform Event: StartTrial
Value: Static ($29 - monthly plan value)
```

**Subscription:**

```
Trigger Event: subscription_created
Platform: Meta Ads
Platform Event: Subscribe
Value: Dynamic (subscription.amount)
```

### Lead Generation

**Lead Form:**

```
Trigger Event: lead_form_submitted
Platform: Meta Ads
Platform Event: Lead
Value: Static ($50 - lead value)
```

**Contact Form:**

```
Trigger Event: contact_submitted
Platform: Google Ads
Platform Event: Submit lead form
Value: Static ($25 - contact value)
```

**Demo Request:**

```
Trigger Event: demo_requested
Platform: Meta Ads
Platform Event: Schedule
Value: Static ($200 - demo value)
```

## Multiple Rules for One Event

You can create multiple rules for the same trigger event to send to multiple platforms:

**Example: Send purchase to all platforms**

**Rule 1:**

```
Trigger: purchase
Platform: Meta Ads
Event: Purchase
Value: order.total_price
```

**Rule 2:**

```
Trigger: purchase
Platform: Google Ads
Event: Purchase
Value: order.total_price
```

**Rule 3:**

```
Trigger: purchase
Platform: TikTok Ads
Event: CompletePayment
Value: order.total_price
```

**Result:** Every purchase is sent to all three platforms automatically.

## Value Paths

Value paths use dot notation to access nested data in your events:

**Simple Property:**

```
Event: {amount: 99.99}
Value Path: amount
Result: $99.99
```

**Nested Property:**

```
Event: {
  order: {
    total: 149.99
  }
}
Value Path: order.total
Result: $149.99
```

**Array Access:**

```
Event: {
  items: [{price: 29.99}, {price: 49.99}]
}
Value Path: items.0.price
Result: $29.99 (first item)
```

**Deep Nesting:**

```
Event: {
  transaction: {
    payment: {
      amount: 199.99
    }
  }
}
Value Path: transaction.payment.amount
Result: $199.99
```

## Standard Event Names

### Meta Ads (Facebook/Instagram)

| Platform Event       | Use Case                |
| -------------------- | ----------------------- |
| Purchase             | E-commerce purchase     |
| AddToCart            | Add item to cart        |
| InitiateCheckout     | Start checkout          |
| Lead                 | Lead form submission    |
| CompleteRegistration | User signup             |
| Subscribe            | Subscription start      |
| StartTrial           | Trial start             |
| ViewContent          | Product page view       |
| Search               | Site search             |
| AddPaymentInfo       | Payment details entered |

### Google Ads

| Platform Event   | Use Case           |
| ---------------- | ------------------ |
| Purchase         | Purchase completed |
| Submit lead form | Lead submission    |
| Sign up          | User registration  |
| Add to cart      | Add to cart        |
| Begin checkout   | Start checkout     |
| Page view        | Page view tracking |

### TikTok Ads

| Platform Event       | Use Case           |
| -------------------- | ------------------ |
| CompletePayment      | Purchase completed |
| AddToCart            | Add to cart        |
| InitiateCheckout     | Start checkout     |
| SubmitForm           | Form submission    |
| CompleteRegistration | User signup        |
| ViewContent          | Content view       |
| Search               | Site search        |

## Advanced Features

### Deduplication

DATALYR automatically prevents duplicate conversions:

**Event ID Matching:**

```
Same event won't be sent twice to the same platform
Uses event.id as unique identifier
Platform deduplicates on their end
```

**7-Day Window:**

```
If rule is triggered again for same event within 7 days
DATALYR skips sending duplicate
Prevents double-counting conversions
```

### Test Mode

Enable test mode to send test conversions:

**Meta Test Events:**

```
Appear in Meta Events Manager → Test Events tab
Won't affect campaign performance
Used for integration testing
```

**Google Test Conversions:**

```
Appear in Google Ads with "test" label
Don't count toward campaign metrics
Used for verification
```

**When to Use:**

* Setting up new conversion rules
* Testing event mapping
* Verifying data format
* Troubleshooting issues

### Attribution Requirements

Conversions require attribution data to be sent:

**Required Data:**

* **Meta:** fbclid, \_fbp, or \_fbc cookie
* **Google:** gclid, gbraid, or wbraid
* **TikTok:** ttclid or \_ttp cookie

**Without Attribution:**

```
Event: purchase (no fbclid)
Conversion Rule: Active
Result: Conversion NOT sent (no attribution data)
```

**With Attribution:**

```
Event: purchase (fbclid present)
Conversion Rule: Active
Result: Conversion sent to Meta with fbclid
```

## Rule Priority and Ordering

If multiple rules match the same event:

* All matching rules are executed
* Rules run in parallel
* Order doesn't matter
* Each platform receives one conversion per rule

## Monitoring Conversions

### Event Stream

View sent conversions in Event Stream:

1. Go to Dashboard → Event Stream
2. Find your conversion event
3. Check "Postbacks" column
4. See which platforms received conversion
5. View success/failure status

### Platform Verification

**Meta:**

* Go to Events Manager → Data Sources → Your Pixel
* Check "Event Activity" for recent conversions
* Look for CAPI badge on events

**Google:**

* Go to Google Ads → Tools → Conversions
* Check recent conversion activity
* Verify "Upload" source appears

**TikTok:**

* Go to TikTok Ads Manager → Events
* Check "Event History" for recent events
* Look for "API" source label

## Troubleshooting

### Rule Not Firing

**Check:**

1. Rule is active (toggle is on)
2. Trigger event name matches exactly
3. Event has required attribution data
4. Platform integration is connected
5. Check Event Stream for errors

**Common Issues:**

* Event name typo (case-sensitive)
* Missing fbclid/gclid/ttclid
* Disconnected platform integration
* Test mode enabled when shouldn't be

### Wrong Value Sent

**Verify:**

1. Value path is correct (check event structure)
2. Property exists in event data
3. Value is a number (not string)
4. Currency matches expectation

**Debug:**

```
View event in Event Stream
Check event_data JSON
Verify value path points to correct field
```

### Conversion Not Appearing in Platform

**Wait Time:**

* Meta: 5-15 minutes
* Google: 3-4 hours
* TikTok: 10-30 minutes

**Check:**

1. Attribution data was present
2. Event sent successfully (check Event Stream)
3. Platform integration is active
4. Conversion within attribution window

## Best Practices

**1. Start with Key Conversions**

```
Priority 1: Purchase
Priority 2: Lead/Signup
Priority 3: Add to cart, checkout
Priority 4: Micro-conversions
```

**2. Use Dynamic Values for Purchases**

```
Always use actual order value
Don't use static values for e-commerce
Enables accurate ROAS tracking
```

**3. Set Realistic Static Values**

```
Leads: Use estimated value or CPA target
Signups: Use LTV or monthly plan value
Trials: Use subscription amount
```

**4. Send to All Platforms**

```
Create rules for Meta, Google, and TikTok
Each platform optimizes differently
More data = better performance
```

**5. Test Before Going Live**

```
Enable test mode first
Verify conversions appear
Check values are correct
Disable test mode for production
```

## Next Steps

<CardGroup cols={2}>
  <Card title="Meta Ads" icon="meta" href="/integrations/meta-ads">
    Configure Meta Ads integration
  </Card>

  <Card title="Google Ads" icon="google" href="/integrations/google-ads">
    Set up Google Ads conversion tracking
  </Card>

  <Card title="TikTok Ads" icon="tiktok" href="/integrations/tiktok-ads">
    Connect TikTok Events API
  </Card>

  <Card title="Event Stream" icon="list" href="/features/event-stream">
    Monitor conversion delivery
  </Card>
</CardGroup>

## Need Help?

Questions about conversion rules? Check our [troubleshooting guide](/troubleshooting/missing-conversions) or contact support.
