Give your workflows analytics context with 3 REST API calls
Any tool that can make a GET request can now pull website analytics. Traffic, pages, sources, funnels — flat JSON, API key auth, no OAuth. That opens up workflows most people haven't thought of yet, like auto-creating GitHub issues when bounce rate spikes after a deploy.
I'll show you the three API calls that cover 90% of analytics workflows, then walk through a specific example: a daily health check that creates a GitHub issue when a page's bounce rate spikes after a deploy. Analytics-driven bug reporting, no one has to remember to check.
The three core calls
Base URL: https://api.lodd.dev/v1. Auth: X-API-Key header.
First, get your site ID (a UUID) from the sites list:
curl -H "X-API-Key: $LODD_KEY" "https://api.lodd.dev/v1/sites"{
"data": [
{ "id": "a25ba756-8f3a-4b2e-9c1d-7e6f5a4b3c2d", "name": "My SaaS", "domain": "example.com", "created_at": "2025-11-02T10:30:00Z" }
]
}Use the id field as $SITE_ID in all subsequent calls.
1. Analytics overview:
curl -H "X-API-Key: $LODD_KEY" \
"https://api.lodd.dev/v1/sites/$SITE_ID/analytics?period=30d"{
"data": {
"total_page_views": 4310,
"unique_visitors": 1842,
"unique_countries": 28,
"average_duration": 47.3,
"pages_per_visit": 2.14,
"bounce_rate": 38.2
}
}Note: the analytics endpoint returns data for the requested period only. To compare periods (e.g. this month vs last month), make two calls with different period parameters:
# Current period
curl -H "X-API-Key: $LODD_KEY" \
"https://api.lodd.dev/v1/sites/$SITE_ID/analytics?period=30d"
# Previous period for comparison
curl -H "X-API-Key: $LODD_KEY" \
"https://api.lodd.dev/v1/sites/$SITE_ID/analytics?period=2026-03-16..2026-04-15"2. Top pages:
curl -H "X-API-Key: $LODD_KEY" \
"https://api.lodd.dev/v1/sites/$SITE_ID/pages?period=7d"{
"data": [
{ "url": "/pricing", "page_title": "Pricing — My SaaS", "page_views": 430, "unique_visitors": 380, "bounce_rate": 55.2, "avg_duration": 62.4 },
{ "url": "/", "page_title": "My SaaS — Home", "page_views": 1200, "unique_visitors": 890, "bounce_rate": 32.1, "avg_duration": 94.7 }
]
}3. Traffic sources:
curl -H "X-API-Key: $LODD_KEY" \
"https://api.lodd.dev/v1/sites/$SITE_ID/sources?period=7d"{
"data": [
{ "source_name": "Google", "source_type": "search", "page_views": 1580, "unique_visitors": 620, "bounce_rate": 35.1, "avg_duration": 71.2, "utm_source": null, "utm_medium": null, "utm_campaign": null },
{ "source_name": "Reddit", "source_type": "social", "page_views": 890, "unique_visitors": 340, "bounce_rate": 42.3, "avg_duration": 38.9, "utm_source": "reddit", "utm_medium": "social", "utm_campaign": null }
]
}Lodd has 49 REST endpoints total, covering funnels, events, session paths, performance, and more. Full API docs. OpenAPI spec.
Example: auto-create GitHub issues when bounce rate spikes
A daily cron pulls page-level analytics for two periods and compares them. If a high-traffic page has a significant bounce rate increase, it creates a GitHub issue with the data baked in. No one has to remember to check.
When this catches real bugs: a deploy broke the pricing page. Bounce rate jumped from 28% to 55% overnight. The issue lands in the backlog at 9am with the page URL, the before/after numbers, and the timestamp.
When this would be noise: a blog post fluctuates by 3%. The trigger needs a threshold.
The trigger logic
current_pages = GET /v1/sites/:id/pages?period=7d
previous_pages = GET /v1/sites/:id/pages?period=2026-05-04..2026-05-10 # previous 7 days
for each page in current_pages:
prev = find matching page in previous_pages
if page.page_views > 50 AND (page.bounce_rate - prev.bounce_rate) > 15:
create_issue(page, prev)Two conditions: the page has enough traffic to matter (50+ page views), and the bounce rate jump is significant (15+ percentage points). Tune these to your traffic levels.
Create the issue
gh issue create \
--title "Bounce rate spike on /pricing (55% vs 28%)" \
--body "## Analytics alert
**Page:** /pricing
**Period:** last 7 days
**Bounce rate:** 55.2% (was 28.4%)
**Page views:** 430
Possible causes:
- Recent deploy broke layout or functionality
- Load time regression
- Low-intent traffic from a new source
Data source: Lodd REST API · lodd.dev/api"The issue has enough context to start investigating immediately. No one has to go pull data first.
Wire it up with any tool
| Tool | Approach |
|---|---|
| GitHub Actions | Scheduled workflow, curl + gh issue create |
| n8n | Schedule → HTTP Request → IF node → GitHub node |
| Trigger.dev | schedules.task with daily cron → fetch → Octokit |
| cron + bash | The curl commands above in a shell script |
A detailed walkthrough for Trigger.dev covers the full setup including multi-site loops, LLM interpretation, and email reporting.
Other workflows worth building
The GitHub issue flow is one pattern. Same API, different outputs:
| Workflow | Trigger | Output |
|---|---|---|
| Monthly client reports | 1st of month | Formatted email per client |
| Slack traffic digest | Weekly | Channel message with top-line numbers |
| Post-deploy check | Webhook from Vercel/Netlify | Snapshot comparison, alert if degraded |
| Content performance sync | Weekly | Notion or Airtable update |
Two interfaces, one data source
Lodd has 42 MCP tools for interactive agent sessions and this REST API for automation. MCP when your agent needs traffic context mid-conversation. REST when you're building something that runs on a schedule.
Same data, same API key. Get started or read the API docs.