Developers · OpenAPI

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" -->
TokenEventProperties
outboundoutbound_clickurl (host + path, no query), host
downloadsfile_downloadfile (path), ext. Matches pdf, office files, csv, zip, audio and video, and a few installers.
404404path. Fires when the page title contains "404" or "not found".
formsform_submitform (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' }

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)

EndpointReturns
GET /stats/sitesSites (hosts and hosted pages) your token can read.
GET /stats/aggregatevisitors, pageviews, bounce_rate, views_per_visit. Add compare=1 for the previous period.
GET /stats/timeseriesDaily 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
siteRequired. Host, e.g. example.com.
nameRequired. Up to 80 characters.
url or pathOptional. Absolute URL or a path. Default /. Query strings are dropped.
props, revenueOptional. Same rules as dsTrack.
visitorOptional. 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_agentOptional. referrer applies to pageview only.

Success is 202 {"ok":true}. Events dropped by your block list or bot filter also return 202 with "ignored".