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

# Profit Tracking

> Track profit by accounting for cost of goods sold (COGS) in Shopify orders

Profit Tracking calculates true profit by subtracting cost of goods sold (COGS) from revenue, giving you accurate ROI and profitability metrics per order, campaign, and customer.

## What It Does

**Calculates Real Profit:**

* Profit = Revenue - COGS
* Profit margin percentage
* Profit by campaign, source, product
* Profit ROAS (profit / ad spend)

**Automatic for Shopify:**

* Reads product costs from Shopify
* Syncs with every order
* Updates metrics every 15 minutes
* Works with historical orders

## How It Works

### Product Costs

Set product costs in Shopify Admin:

```
Products → Select Product → Pricing
Cost per item: $45.00
```

DATALYR reads this cost and calculates profit automatically:

```
Order Revenue: $149.00
Product Cost: $45.00
Profit: $104.00
Profit Margin: 69.8%
```

Each product variant can have its own cost.

### Profit Metrics

**Dashboard Shows:**

* Shopify Profit (total for period)
* Profit Margin (profit / revenue × 100)
* Average Order Profit
* Profit by campaign
* Profit by product

**Order-Level:**

* Revenue per order
* COGS per order
* Profit per order
* Profit margin per order

## Use Cases

**Campaign Profitability**

```
Campaign: summer_sale_2025
Revenue: $21,605
COGS: $6,482
Profit: $15,123
Profit ROAS: 1.60

Compare to other campaigns
Optimize for profit, not just revenue
```

**Channel Comparison**

```
Google Ads: 64% margin, 1.92 profit ROAS
Meta Ads: 64% margin, 1.82 profit ROAS
Organic: 70% margin, no ad cost

Identify most profitable channels
```

**Product Analysis**

```
Product A: 70% margin, high volume
Product B: 40% margin, low volume

Focus marketing on high-margin products
Adjust pricing or costs
```

**Discount Impact**

```
Full price: 70% margin
20% off: 62% margin

Calculate true cost of discounts
Set minimum discount thresholds
```

**Lifetime Profit**

```
Customer LTV: $520 profit across 5 orders
CAC target: $150 (based on 3.5x LTV)

Set acquisition cost targets based on profit
```

## Profit-Based Ad Optimization

### Send Profit to Ad Platforms

Configure Conversion Rules to send profit instead of revenue:

**Standard (Revenue):**

```
Conversion Rule: purchase
Value: order.total_price
Sends: $149.00 to Meta
```

**Profit-Based:**

```
Conversion Rule: purchase
Value: profit
Sends: $104.00 to Meta
```

**Result:** Ad platforms optimize for profit, not revenue. Better bidding decisions.

### Profit ROAS Targets

**Google Ads Example:**

```
Old target: 300% ROAS (based on revenue)
New target: 200% ROAS (based on profit)

More realistic targets
Better campaign performance
```

## Setup Requirements

**Shopify Only:**

* Profit tracking requires Shopify integration
* Other platforms (Stripe) don't include COGS
* Must set product costs in Shopify

**Cost Data Required:**

* Products without costs show \$0 COGS
* Overestimates profit if costs missing
* Always set costs before tracking

**Historical Sync:**

* Backfills last 90 days on initial sync
* New orders sync every 15 minutes
* Cost changes don't affect past orders

## Best Practices

**Set Costs Immediately:**

* Add cost when creating product
* Update costs when supplier prices change
* Include all costs (manufacturing, packaging, shipping to warehouse)

**Monitor Profit Trends:**

* Check profit margin weekly
* Track profit ROAS by channel
* Alert if margin drops below target

**Use Profit for Decisions:**

* Set CAC based on profit LTV, not revenue
* Optimize campaigns for profit ROAS
* Focus on high-margin products

**Account for All Costs:**

* Product manufacturing cost
* Packaging and materials
* Shipping to warehouse
* Import duties and taxes

## Next Steps

<CardGroup cols={2}>
  <Card title="Shopify Integration" icon="bag-shopping" href="/integrations/shopify">
    Set up Shopify integration
  </Card>

  <Card title="Reports" icon="chart-bar" href="/features/reports">
    View profit by attribution
  </Card>

  <Card title="Dashboard" icon="gauge" href="/features/dashboard">
    Monitor profit metrics
  </Card>

  <Card title="Conversion Rules" icon="arrows-turn-to-dots" href="/integrations/conversion-rules">
    Send profit to ad platforms
  </Card>
</CardGroup>
