Skip to main content
GET
https://app.usehardal.com
/
api
/
websites
/
{websiteId}
/
campaign-metrics
Campaign Metrics API
curl --request GET \
  --url https://app.usehardal.com/api/websites/{websiteId}/campaign-metrics \
  --header 'Authorization: Bearer <token>'
{
  "source_medium": [
    {
      "source": "google",
      "medium": "cpc",
      "campaign": "summer_sale",
      "visitors": 150,
      "conversions": 12,
      "conversion_rate": 8.0,
      "total_value": 1200.50,
      "visitor_percentage": 45.5
    }
  ],
  "utm_sources": [
    {
      "source": "google",
      "visitors": 200,
      "conversions": 15,
      "total_value": 1500.00,
      "visitor_percentage": 60.6
    }
  ],
  "utm_mediums": [
    {
      "medium": "cpc",
      "visitors": 180,
      "conversions": 14,
      "total_value": 1400.00,
      "visitor_percentage": 54.5
    }
  ],
  "utm_campaigns": [
    {
      "campaign": "summer_sale",
      "visitors": 100,
      "conversions": 8,
      "total_value": 800.00,
      "visitor_percentage": 30.3
    }
  ],
  "campaigns": [
    {
      "source": "google",
      "medium": "cpc",
      "campaign": "summer_sale",
      "visitors": 100,
      "conversions": 8,
      "conversion_rate": 8.0,
      "total_value": 800.00
    }
  ],
  "pagination": {
    "total": 25,
    "limit": 5,
    "offset": 0,
    "currentPage": 1,
    "totalPages": 5,
    "hasMore": true
  },
  "meta": {
    "timeframe": "today",
    "attribution_model": "any_click",
    "attribution_window_days": 30,
    "user_identification_method": "session",
    "conversion_event": "purchase",
    "utm_source": "url",
    "filter": null,
    "startDate": "2025-07-01T00:00:00.000Z",
    "endDate": "2025-07-01T23:59:59.999Z",
    "conversion_tracking": true,
    "value_tracking": true,
    "value_field": "value",
    "currency": "TRY",
    "total_source_medium": 25,
    "total_campaigns": 25,
    "advanced_attribution": true,
    "total_conversions": 45,
    "total_conversions_attributed": 42,
    "total_value": 4500.00,
    "total_value_attributed": 4200.00
  }
}
Get comprehensive campaign attribution and performance metrics for UTM-based marketing campaigns. Track visitor attribution, conversion rates, revenue attribution, and campaign performance across multiple attribution models.
websiteId
string
required
Your website signal ID
targetSignalId
string
required
Target signal ID for analytics data (use inherited signal ID if different from websiteId, otherwise same as websiteId)
isHybrid
boolean
required
Whether the signal uses hybrid tracking
timeframe
string
Time period: today, yesterday, last7days, last30days, custom
startDate
string
Start date for custom timeframe (ISO format)
endDate
string
End date for custom timeframe (ISO format)
conversion_event
string
required
Event name for conversion tracking (e.g., purchase)
attribution_model
string
Attribution model: last_click, first_click, any_click, linear, time_decay
attribution_window
number
Attribution window in days: 1, 7, 14, 30, 60, 90, 180
user_identification_method
string
User tracking method: session, user_email, user_id
timezone
string
Timezone for date calculations (URL encoded)
value_field
string
required
Field name for revenue/value tracking
currency
string
Currency code for value calculations
limit
number
default:"50"
Number of campaigns to return
offset
number
default:"0"
Pagination offset
{
  "source_medium": [
    {
      "source": "google",
      "medium": "cpc",
      "campaign": "summer_sale",
      "visitors": 150,
      "conversions": 12,
      "conversion_rate": 8.0,
      "total_value": 1200.50,
      "visitor_percentage": 45.5
    }
  ],
  "utm_sources": [
    {
      "source": "google",
      "visitors": 200,
      "conversions": 15,
      "total_value": 1500.00,
      "visitor_percentage": 60.6
    }
  ],
  "utm_mediums": [
    {
      "medium": "cpc",
      "visitors": 180,
      "conversions": 14,
      "total_value": 1400.00,
      "visitor_percentage": 54.5
    }
  ],
  "utm_campaigns": [
    {
      "campaign": "summer_sale",
      "visitors": 100,
      "conversions": 8,
      "total_value": 800.00,
      "visitor_percentage": 30.3
    }
  ],
  "campaigns": [
    {
      "source": "google",
      "medium": "cpc",
      "campaign": "summer_sale",
      "visitors": 100,
      "conversions": 8,
      "conversion_rate": 8.0,
      "total_value": 800.00
    }
  ],
  "pagination": {
    "total": 25,
    "limit": 5,
    "offset": 0,
    "currentPage": 1,
    "totalPages": 5,
    "hasMore": true
  },
  "meta": {
    "timeframe": "today",
    "attribution_model": "any_click",
    "attribution_window_days": 30,
    "user_identification_method": "session",
    "conversion_event": "purchase",
    "utm_source": "url",
    "filter": null,
    "startDate": "2025-07-01T00:00:00.000Z",
    "endDate": "2025-07-01T23:59:59.999Z",
    "conversion_tracking": true,
    "value_tracking": true,
    "value_field": "value",
    "currency": "TRY",
    "total_source_medium": 25,
    "total_campaigns": 25,
    "advanced_attribution": true,
    "total_conversions": 45,
    "total_conversions_attributed": 42,
    "total_value": 4500.00,
    "total_value_attributed": 4200.00
  }
}