Ghost ID Docs
Product documentation
Back to Dashboard

Revenue API

The Revenue API returns attributed revenue data for a site across summary metrics, attribution breakdowns, campaigns, recent transactions, and daily trends.

🌐 Endpoint

GET/api/revenue

Return revenue dashboard data for a site.

🔑 Authentication required: Yes, via session cookie.

Parameters

NameTypeRequiredDescription
siteIdnumberYesSite to query.
timeRangestringNoOne of 7d, 30d, 90d, or all. Defaults to 30d.

Example Request

Bash
curl --request GET \
  --url "https://analytics.ghostid.ai/api/revenue?siteId=4&timeRange=30d" \
  --cookie "session=YOUR_SESSION_COOKIE"

Response Example

JSON
{
  "summary": {
    "total_revenue": "19452.00",
    "total_transactions": "83",
    "avg_order_value": "234.36",
    "unique_customers": "51",
    "largest_transaction": "2499.00"
  },
  "by_attribution": [
    {
      "channel": "Organic",
      "source": "google",
      "revenue": "8450.00",
      "transactions": "29",
      "customers": "21"
    },
    {
      "channel": "Email",
      "source": "newsletter",
      "revenue": "5100.00",
      "transactions": "18",
      "customers": "12"
    }
  ],
  "by_campaign": [
    {
      "campaign": "spring-2026",
      "source": "newsletter",
      "medium": "email",
      "revenue": "3200.00",
      "transactions": "11",
      "customers": "8"
    }
  ],
  "recent_transactions": [
    {
      "id": 912,
      "ghost_vid": "gv_a1b2c3d4_e5f6g7h8",
      "amount": "499.00",
      "currency": "USD",
      "source": "stripe",
      "first_touch_channel": "Organic",
      "first_touch_source": "google",
      "first_touch_campaign": "brand-search",
      "identified_email": "jane@example.com",
      "transaction_id": "txn_123",
      "created_at": "2026-03-10T17:10:02.000Z"
    }
  ],
  "daily": [
    {
      "date": "2026-03-01T00:00:00.000Z",
      "revenue": "1299.00",
      "transactions": "5"
    },
    {
      "date": "2026-03-02T00:00:00.000Z",
      "revenue": "1888.00",
      "transactions": "7"
    }
  ]
}

📋 Response Shape

  • summary returns total revenue, total transactions, average order value, unique customers, and the largest transaction.
  • by_attribution groups revenue by first-touch channel and source.
  • by_campaign groups revenue by campaign, source, and medium.
  • recent_transactions lists the latest attributed revenue records.
  • daily returns date-based revenue and transaction totals.