Ad Performance Analytics
Analyze your advertising campaigns across Meta (Facebook/Instagram), Google Ads, Snapchat, and TikTok with true profit-based ROAS calculations.
GET /v1/analytics/ad-performance
Get comprehensive advertising performance metrics.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | today, yesterday, 7d, 30d, 90d (default: 30d) |
platform | string | No | meta, google, snapchat, tiktok, all (default: all) |
startDate | string | No | Custom start date (YYYY-MM-DD) |
endDate | string | No | Custom end date (YYYY-MM-DD) |
Example Request
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/analytics/ad-performance?period=30d&platform=meta"Response
json
{
"success": true,
"data": {
"platform": "meta",
"totalSpend": 8000,
"totalRevenue": 50000,
"totalProfit": 15000,
"roas": 6.25,
"profitRoas": 1.88,
"clicks": 15000,
"impressions": 450000,
"ctr": 3.33,
"cpc": 0.53,
"conversions": 250,
"conversionRate": 1.67,
"costPerConversion": 32.0
}
}Response Fields
| Field | Type | Description |
|---|---|---|
totalSpend | number | Total ad spend in SAR |
totalRevenue | number | Revenue attributed to ads |
totalProfit | number | Net profit after all costs |
roas | number | Revenue ROAS (revenue / spend) |
profitRoas | number | Profit ROAS (profit / spend) - unique to Looha |
clicks | number | Total ad clicks |
impressions | number | Total ad impressions |
ctr | number | Click-through rate (%) |
cpc | number | Cost per click |
conversions | number | Number of conversions |
conversionRate | number | Conversion rate (%) |
costPerConversion | number | Cost per conversion |
GET /v1/analytics/funnel
Analyze the complete conversion funnel from ad click to purchase.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | 7d, 30d, 90d (default: 30d) |
platform | string | No | Platform filter |
Example Request
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/analytics/funnel?period=30d"Response
json
{
"success": true,
"data": {
"funnel": [
{
"stage": "Ad Impressions",
"count": 450000,
"percentage": 100,
"dropOff": 0
},
{
"stage": "Ad Clicks",
"count": 15000,
"percentage": 3.33,
"dropOff": 96.67
},
{
"stage": "Store Visits",
"count": 12000,
"percentage": 2.67,
"dropOff": 0.66
},
{
"stage": "Add to Cart",
"count": 3000,
"percentage": 0.67,
"dropOff": 2.0
},
{
"stage": "Initiated Checkout",
"count": 1500,
"percentage": 0.33,
"dropOff": 0.34
},
{
"stage": "Completed Purchase",
"count": 250,
"percentage": 0.056,
"dropOff": 0.27
}
],
"summary": {
"totalImpressions": 450000,
"totalOrders": 250,
"overallConversionRate": 0.056
}
}
}GET /v1/analytics/roas-by-platform
Compare ROAS across all advertising platforms.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | 7d, 30d, 90d (default: 30d) |
sortBy | string | No | roas, profitRoas, spend, profit (default: profitRoas) |
Example Request
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/analytics/roas-by-platform?period=30d&sortBy=profitRoas"Response
json
{
"success": true,
"data": {
"platforms": [
{
"platform": "meta",
"spend": 8000,
"revenue": 50000,
"profit": 15000,
"roas": 6.25,
"profitRoas": 1.88,
"orders": 250
},
{
"platform": "google",
"spend": 5000,
"revenue": 35000,
"profit": 10500,
"roas": 7.0,
"profitRoas": 2.1,
"orders": 175
},
{
"platform": "snapchat",
"spend": 2000,
"revenue": 10000,
"profit": 3000,
"roas": 5.0,
"profitRoas": 1.5,
"orders": 50
},
{
"platform": "tiktok",
"spend": 1000,
"revenue": 6000,
"profit": 1800,
"roas": 6.0,
"profitRoas": 1.8,
"orders": 30
}
],
"totals": {
"totalSpend": 16000,
"totalRevenue": 101000,
"totalProfit": 30300,
"avgRoas": 6.31,
"avgProfitRoas": 1.89
}
}
}GET /v1/analytics/campaigns
Get performance breakdown by campaign.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | 7d, 30d, 90d (default: 30d) |
platform | string | No | Filter by platform |
status | string | No | active, paused, all (default: active) |
limit | number | No | Number of campaigns (default: 50) |
Example Request
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/analytics/campaigns?period=30d&platform=meta&limit=10"Response
json
{
"success": true,
"data": {
"campaigns": [
{
"id": "camp_123",
"name": "Winter Sale 2024",
"platform": "meta",
"status": "active",
"spend": 3000,
"revenue": 22000,
"profit": 6600,
"roas": 7.33,
"profitRoas": 2.2,
"clicks": 5500,
"conversions": 110
},
{
"id": "camp_456",
"name": "Product Launch - Headphones",
"platform": "meta",
"status": "active",
"spend": 2000,
"revenue": 14000,
"profit": 4200,
"roas": 7.0,
"profitRoas": 2.1,
"clicks": 3800,
"conversions": 70
}
],
"meta": {
"total": 25,
"showing": 10
}
}
}GET /v1/analytics/attribution
Get detailed attribution data showing how orders are linked to ads.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
period | string | No | 7d, 30d, 90d (default: 30d) |
attributionWindow | number | No | Days to attribute (1-30, default: 7) |
Example Request
bash
curl -H "Authorization: Bearer looha_your_api_key" \
"https://api.looha.app/v1/analytics/attribution?period=30d&attributionWindow=7"Response
json
{
"success": true,
"data": {
"attributionModel": "last_click_7_day",
"totalOrders": 450,
"attributedOrders": 380,
"attributionRate": 84.4,
"breakdown": {
"meta": {
"orders": 200,
"percentage": 52.6
},
"google": {
"orders": 120,
"percentage": 31.6
},
"snapchat": {
"orders": 40,
"percentage": 10.5
},
"tiktok": {
"orders": 20,
"percentage": 5.3
}
},
"unattributedOrders": 70,
"organicOrders": 70
}
}Understanding Profit ROAS
Profit ROAS is Looha's unique metric that shows true profitability:
Profit ROAS = (Revenue - All Costs) / Ad SpendExample:
- Revenue: 50,000 SAR
- Product Cost: 30,000 SAR
- Ad Spend: 8,000 SAR
- Other Costs: 2,000 SAR
Traditional ROAS: 50,000 / 8,000 = 6.25xProfit ROAS: (50,000 - 30,000 - 2,000) / 8,000 = 2.25x
Profit ROAS shows you're actually making 2.25 SAR profit for every 1 SAR spent on ads, not 6.25 SAR.
Error Responses
400 Bad Request
json
{
"success": false,
"error": "Invalid platform. Must be: meta, google, snapchat, tiktok, or all"
}404 Not Found
json
{
"success": false,
"error": "No advertising data found for this period"
}Use Cases
Compare Platform Performance
python
import requests
API_KEY = 'looha_your_api_key'
response = requests.get(
'https://api.looha.app/v1/analytics/roas-by-platform',
params={'period': '30d'},
headers={'Authorization': f'Bearer {API_KEY}'}
)
platforms = response.json()['data']['platforms']
best_platform = max(platforms, key=lambda p: p['profitRoas'])
print(f"Best performing platform: {best_platform['platform']}")
print(f"Profit ROAS: {best_platform['profitRoas']}x")Track Funnel Drop-offs
javascript
const API_KEY = 'looha_your_api_key'
const response = await fetch(
'https://api.looha.app/v1/analytics/funnel?period=30d',
{
headers: { 'Authorization': `Bearer ${API_KEY}` }
}
)
const funnel = await response.json()
const stages = funnel.data.funnel
stages.forEach((stage, index) => {
if (index > 0) {
console.log(`${stage.stage}: ${stage.dropOff}% drop-off`)
}
})Next: AI Recommendations →