Docs

Add Datawyre to a site, then read your numbers from your own server or AI.

Add the script

Add the site in Datawyre, then put this tag in the head of every page. The site's page in Datawyre shows it with your site id filled in.

<script defer src="https://data.postwyre.com/s.js" data-site="YOUR_SITE_ID"></script>

Prove the site is yours

Visits count once one of these checks passes. Your code is on the site's page in Datawyre. Then choose Check now on that page, or call POST /v1/brand/sites/<siteId>/verify.

Any one of theseHome page tagOr a fileOr a DNS recordCheck nowVerifiedVisits count
A tag on your home page
<meta name="datawyre-verify" content="your code"> in the head of https://example.com/. The check reads the head of that page, following up to 3 redirects on the same site, and finds the tag only as a real tag there, not in a comment, a script or the body. It passes as soon as the page is live. Steps for each website builder.
Or a file
Your code, and nothing else, at https://example.com/.well-known/datawyre.txt. The check passes as soon as the file is live.
Or a DNS record
A TXT record at _datawyre.example.com with the value datawyre-verify=your code. DNS can take a few minutes to show.

If an ad blocker stops the script

Serve the same script from /_dw/ on your own site, through a Cloudflare Worker or nginx, with a key Datawyre keeps only a hash of. The site's page in Datawyre has both setups and makes the key. Then use this tag in place of the one above:

<script defer src="/_dw/s.js" data-site="YOUR_SITE_ID"></script>
Without the proxyBrowserDatawyreAd blockerWith the proxy routeBrowserYour site /_dw/Datawyre

Sign your signups

A signup goal counts as unsigned, and claims no source, until your server signs it. An owner or admin makes the signup secret in Datawyre, under Settings, Signup secret. It is shown once. Keep it on your server, never in a page.

For each new user, your server signs their user id and puts both in the page that sends the goal:

import { createHmac } from "node:crypto"; const sig = createHmac("sha256", process.env.DATAWYRE_SIGNUP_SECRET).update("signup." + userId).digest("hex");
window.tfa("signup", { uid: "<user id>", sig: "<sig from your server>" })

The signature is hex(HMAC-SHA256(secret, "signup." + userId)). A user id is 1 to 80 letters, digits, _ - : .; any other id counts as unsigned. Replace the secret in Settings if it is lost. The old one keeps working for 24 hours, so you can update your server first.

Brand tokens

Your server or AI sends a brand token as Authorization: Bearer dwb_.... The brand always comes from the token. An owner or admin makes one in Datawyre, under Settings > Connect your agent, and an admin token makes more.

Read token
Reads the brand, its sites, visits, breakdowns, the workspace report and dashboards.
Admin token
Also adds, verifies and removes sites, saves and deletes dashboards, and makes tokens with POST /v1/brand/tokens.
Agent powers
Off for every token until you turn them on in Agent keys. They let an admin token make proxy keys and the signup secret, revoke tokens, export your data and delete a person's data. Revoking a token waits for you to approve it, unless you turn off Ask me first for that key.
Another brand
A token reaches its own brand only. Anything of another brand's gets 404, the same answer as something that does not exist.

Read your numbers

Every endpoint is on https://data.postwyre.com and answers JSON. Add site=<siteId> to visits, breakdown or sources to keep to one site.

GET /v1/brand
Your brand, your role and its sites.
GET /v1/brand/visits?days=30
Visitors and page views by people per UTC day, today included. days is 1 to 400.
GET /v1/brand/breakdown?by=source
The same traffic grouped by one of source, medium, campaign, referrer, page, country, device, browser, os, goal. Up to 50 rows, most visitors first.
GET /v1/brand/sources
Where visitors came from, what is kept apart as internal and what is filtered, each with its reason.
GET /v1/brand/report?workspace_id=<brand>&period=7d
The last 7 or 30 days against the period before. workspace_id is your own brand id.

Each token gets 120 requests a minute per Cloudflare location. Over that the answer is 429 with Retry-After: 60. A read gives the same answer when called twice with nothing new stored.

Connect your AI

Datawyre is an MCP server at https://data.postwyre.com/mcp. Your AI gets the same numbers as the API, through tools such as visits, breakdown and get_workspace_report.

Continue with Postwyre

No token to copy. In Claude Code, run this, then type /mcp, pick datawyre and choose Authenticate.

claude mcp add --transport http datawyre https://data.postwyre.com/mcp

With a brand token

A read token is enough to read and is the safer choice. Saving a dashboard needs an admin token.

claude mcp add --transport http datawyre https://data.postwyre.com/mcp --header "Authorization: Bearer dwb_your_token"