Privacy and consent
datacub tracks from the first page view by default, with no banner to wire. You can ask for consent first, and every project honours opt-outs and deletion requests.
Ask for consent first (optional)
- In Settings, Privacy, turn on Ask for consent first.
- Add
requireConsent: truetodatacub.init(on the one-tag install, thedata-require-consentattribute). - Call
datacub.consent.grant()when the visitor agrees anddatacub.consent.revoke()when they withdraw.
datacub.init('YOUR_PROJECT_ID', { requireConsent: true })
// the visitor accepted analytics
datacub.consent.grant({ method: 'banner', policyVersion: '2026-10' })// the visitor withdrew it, for example from your privacy settings
function onAnalyticsToggleOff() {
datacub.consent.revoke()
}Before grant() the SDK writes no cookies, stores nothing and sends nothing, and the server refuses events without a grant. The web SDK does not remember a grant between page loads: your banner stores the answer, so call grant() on each page load while it says yes. identify before grant() waits in memory. The install snippet in Settings adds the consent lines for you when the setting is on.
grant options, all optional: method (banner, settings, api or cmp), policyVersion, and overrideGPC.
Opt-out, in every project
datacub.consent.revoke() always works. It stops sending, deletes the SDK's cookies and queue, and remembers the opt-out on that device (the datacub_optout cookie, no identifier). An explicit grant() clears it.
If the browser sends Global Privacy Control, datacub treats it as an opt-out. Pass overrideGPC: true to grant() only from the visitor's own click on an opt-in control.
What datacub never collects
- form field values or URL fragments
- passwords, OTPs, card data, IBANs, national or Iqama IDs, tokens: dropped or redacted on the device and again on the server
- raw IP addresses: used in memory for the country and city and for rate limits, never stored
- device fingerprints or advertising IDs
Data is stored in Saudi Arabia. Requests to in.datacub.to pass through Cloudflare, which tells datacub the approximate location of the IP address. The network operator comes from a database inside datacub's collection service. Details are in datacub's privacy notice and the DPA.
IP to network data by DB-IP (CC BY 4.0).
Delete or export a person
Owners and admins do it in Settings, Privacy, under One person's data: type the user ID you pass to identify, then Download their data or Delete this person's data. For guests who never signed in, open their profile on the People page. To do it from your own backend, for example when your account deletion runs, use an existing read key (rk_) that an owner allowed to handle person requests; the dashboard no longer makes new ones. Read keys are for your server only.
// on your server only: a read key opens your dashboard, never ship it to a browser or app
export async function deleteFromDatacub(userId: string) {
const url = `https://datacub.to/api/backend/projects/${process.env.DATACUB_PROJECT_ID}/persons/user/${encodeURIComponent(userId)}`
const res = await fetch(url, {
method: 'DELETE',
headers: { Authorization: `Bearer ${process.env.DATACUB_READ_KEY}` },
})
if (res.status !== 202) throw new Error(`datacub deletion failed: ${res.status}`)
return (await res.json()) as { id: string; status: 'deleted' | 'held' }
}curl -X DELETE "https://datacub.to/api/backend/projects/$DATACUB_PROJECT_ID/persons/user/user_8f3a2c" \
-H "Authorization: Bearer $DATACUB_READ_KEY"| Request | Does |
|---|---|
DELETE /api/backend/projects/:id/persons/user/:userId | deletes a Registered user and every browser and phone linked to them |
DELETE /api/backend/projects/:id/persons/browser/:anonId | deletes a Guest, by the ID in the datacub_id_<key> cookie |
GET .../persons/user/:userId/export | everything datacub holds about them, as one JSON file |
POST /api/backend/projects/:id/consent/revoke | body { "user_id": "..." } or { "anon_id": "..." }: a withdrawal your backend saw; deletes what was collected |
DELETE /api/backend/projects/:id/tombstones/user/:userId | lets a deleted user ID be tracked again, from then on |
A deletion answers 202 with status deleted, or held during a legal hold (carried out when it lifts). Errors: 401 unauthenticated, 403 capability_required (the key may not handle person requests), 400 invalid_person, 429 rate_limited (60 a minute).
The person leaves every report at once. datacub deletes again 48 hours later to catch events still on their way, and backups that held them expire within 35 days. New events for a deleted user ID are refused.