Documentation
Everything you need to integrate Devlune Webmaster into your site.
Getting Started
Add your site in the dashboard, then drop a single script tag on your page. That's it.
- Go to Dashboard → Add Site
- Copy the tracking script
- Paste it before
</head>on your site - Visit your site — data appears in seconds
Analytics Script
Privacy-first, cookieless analytics. Under 2KB gzipped.
HTML
<script defer src="https://devlune-webmaster-edge.sidharth-6f3.workers.dev/embed/analytics.js" data-site="YOUR_SITE_ID"></script>
Replace YOUR_SITE_ID with your site ID from the dashboard.
Next.js
app/layout.tsx
import Script from 'next/script';
export default function Layout({ children }) {
return (
<html>
<head>
<Script src="https://devlune-webmaster-edge.sidharth-6f3.workers.dev/embed/analytics.js" data-site="YOUR_SITE_ID" strategy="afterInteractive" />
</head>
<body>{children}</body>
</html>
);
}WordPress
functions.php
function devlune_analytics() {
echo '<script defer src="https://devlune-webmaster-edge.sidharth-6f3.workers.dev/embed/analytics.js" data-site="YOUR_SITE_ID"></script>';
}
add_action('wp_head', 'devlune_analytics');Custom Events
JavaScript
// Track a custom event
devlune.track('button_click', { button: 'signup', page: '/pricing' });View Counter
Beautiful, customizable counters. Create one in the dashboard, then embed it.
Script embed (interactive widget)
HTML
<script defer src="https://devlune-webmaster-edge.sidharth-6f3.workers.dev/embed/view-counter.js" data-id="YOUR_COUNTER_ID"></script>
Badge embed (for READMEs, emails)
Markdown

HTML
<img src="https://devlune-webmaster-edge.sidharth-6f3.workers.dev/badge/YOUR_SITE_ID/page-path" alt="Views" />
JSON API
curl
curl "https://devlune-webmaster-edge.sidharth-6f3.workers.dev/badge/YOUR_SITE_ID/page-path?format=json"
# → {"siteId":"...","page":"/...","count":1234,"mode":"total"}Custom Forms
Embed forms with full CSS control via Shadow DOM isolation.
Script embed
HTML
<script defer src="https://devlune-webmaster-edge.sidharth-6f3.workers.dev/embed/forms.js" data-form="YOUR_FORM_ID"></script> <div id="devlune-form"></div>
Headless mode (POST directly)
JavaScript
// 1. Get a token
const { token } = await fetch('https://devlune-webmaster-edge.sidharth-6f3.workers.dev/embed/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ formId: 'YOUR_FORM_ID' }),
}).then(r => r.json());
// 2. Submit
await fetch('https://devlune-webmaster-edge.sidharth-6f3.workers.dev/ingest/form', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`,
},
body: JSON.stringify({
name: 'John',
email: 'john@example.com',
message: 'Hello!',
}),
});Spam protection
Forms are protected by Cloudflare Turnstile (invisible) + rate limiting (5 submissions/min per IP). No CAPTCHAs shown to users.
API Reference
All endpoints require authentication via session cookie (dashboard) or service role key (server-to-server).
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/sites | List all sites |
| POST | /api/sites | Create a site |
| GET | /api/forms | List all forms |
| POST | /api/forms | Create a form |
| GET | /api/counters | List all counters |
| POST | /api/counters | Create a counter |
| POST | /api/billing/checkout | Create Stripe checkout session |
Worker Endpoints (Public)
| Method | Endpoint | Description |
|---|---|---|
| POST | /ingest/analytics | Pageview/event ingest |
| POST | /ingest/form | Form submission |
| GET | /badge/:siteId/:page | View counter badge (SVG/JSON/HTML) |
| POST | /embed/token | Mint form embed token |
| GET | /embed/*.js | Embed scripts (from R2) |