Analytics tracker, Stats API and Events API
Everything below is part of DotSpider first-party analytics (Pro and above, included in the trial). Tracked-site limits on your plan apply when you add a site; existing sites and their data are kept. Visitors are counted from a salted hash of their IP: no cookies and no persistent identifiers.
1. Tracker tag
<script src="/a.js" defer></script>
Serve /a.js and POST /a from your own domain (a Cloudflare Worker route or reverse proxy). Existing tags keep working unchanged.
Automatic events (opt in)
<script src="/a.js" data-auto="outbound,downloads,404,forms" defer></script>
<!-- or data-auto="all" -->
| Token | Event | Properties |
|---|---|---|
outbound | outbound_click | url (host + path, no query), host |
downloads | file_download | file (path), ext. Matches pdf, office files, csv, zip, audio and video, and a few installers. |
404 | 404 | path. Fires when the page title contains "404" or "not found". |
forms | form_submit | form (id, name or action path). Add data-ds-ignore to a form to skip it. |
Create a goal with type "event" and the same name to count any of these as conversions.
Custom events, properties and revenue
dsTrack('signup')
dsTrack('signup', { props: { plan: 'pro', source: 'pricing' } })
dsTrack('purchase', { props: { sku: 'A-100' }, revenue: { amount: 49.99, currency: 'USD' } })
// properties on every pageview of this page (set before the tag runs)
window.dsProps = { author: 'sam', section: 'blog' }
- Up to 10 properties per event. Keys: 40 characters of
a-z 0-9 _ . : -. Values: 120 characters, strings. - Each key keeps at most 50 distinct values per event per day. Extra values are dropped.
- Events are not counted as pageviews. Calling the same event with the same properties twice within one second counts once.
- Revenue is stored per currency. A goal's value is the USD revenue its events carried, plus the goal's lead value for every conversion that carried none. Other currencies are listed separately.
UTM content and term
utm_content and utm_term are collected next to utm_source, utm_medium and utm_campaign automatically.
Scroll depth
Collected automatically when a visitor leaves a page: the deepest 25% step reached (0, 25, 50, 75 or 100). The dashboard shows average depth and the share that reached 50% or more, per page.
Exclude your own visits
// in your browser console, once per browser
localStorage.ds_ignore = 'true'
// or open any page of your site with ?ds_ignore=true (use ?ds_ignore=false to count again)
2. Authentication
Create a token at Developers (Pro or Portfolio). Use a read token for the Stats API and a read + write token for the Events API.
curl -H "Authorization: Bearer $DOTSPIDER_TOKEN" https://dotspider.com/api/v1/stats/sites
Limits: 120 requests per minute per token. Errors are JSON: { "error": "..." } with 401 (bad token), 402 (plan), 403 (scope or site), 404 (unknown site), 400 (bad input).
3. Stats API (read scope)
| Endpoint | Returns |
|---|---|
GET /stats/sites | Sites (hosts and hosted pages) your token can read. |
GET /stats/aggregate | visitors, pageviews, bounce_rate, views_per_visit. Add compare=1 for the previous period. |
GET /stats/timeseries | Daily visitors and pageviews. |
GET /stats/breakdown?property=… | One of: page, entry_page, source, country, device, event, event_prop (needs event, optional key), scroll_depth, revenue, utm_content_term, goal. |
Common query parameters: site (a host such as example.com, default all your sites), period (today, 7d, 30d, mtd, all or custom with date_from and date_to as YYYY-MM-DD, UTC), limit (1 to 100), and the filters path, referrer, country, device.
curl -H "Authorization: Bearer $DOTSPIDER_TOKEN" \
"https://dotspider.com/api/v1/stats/aggregate?site=example.com&period=30d&compare=1"
curl -H "Authorization: Bearer $DOTSPIDER_TOKEN" \
"https://dotspider.com/api/v1/stats/breakdown?site=example.com&property=event_prop&event=signup&key=plan"
{ "range": { "from": "2026-10-28", "to": "2026-11-26", "period": "30d" },
"results": { "visitors": 1204, "pageviews": 3380, "bounce_rate": 0.61, "views_per_visit": 2.8 } }
4. Events API (write scope)
POST https://dotspider.com/api/v1/events records an event from your server. The site must be a host on your account with verified analytics. Use the name pageview to record a server-side pageview.
curl -X POST https://dotspider.com/api/v1/events \
-H "Authorization: Bearer $DOTSPIDER_TOKEN" -H "Content-Type: application/json" \
-d '{
"site": "example.com",
"name": "purchase",
"url": "https://example.com/checkout/thanks",
"props": { "sku": "A-100", "plan": "pro" },
"revenue": { "amount": 49.99, "currency": "USD" },
"visitor": "customer-8841"
}'
| Field | |
|---|---|
site | Required. Host, e.g. example.com. |
name | Required. Up to 80 characters. |
url or path | Optional. Absolute URL or a path. Default /. Query strings are dropped. |
props, revenue | Optional. Same rules as dsTrack. |
visitor | Optional. Any stable id. It is hashed with a private salt, never stored. Pass it so unique counts work; without it, the caller's IP is used. |
referrer, country, user_agent | Optional. referrer applies to pageview only. |
Success is 202 {"ok":true}. Events dropped by your block list or bot filter also return 202 with "ignored".