Skip to content

Browser tag

The browser tag is a small script that recognizes the device and notices automation on the pages where people sign up, sign in, apply, or pay. It sends what it gathers to the collector and gives your form a request_id. Your server passes that ID to the decision API, which is how a decision knows the device.

The tag reads counts and timings (how the pointer moved, how long typing took), never what someone types.

<script src="https://c.opencontext.com/t.js" data-key="oc_pk_live_…" async></script>

data-key is your publishable site key. It is safe in a page: it can only send signals, and only from the domains you allow on the key.

Mark each protected form with data-collect, naming the event:

<form method="post" action="/login" data-collect="login"> … </form>

On submit, the tag collects, adds a hidden input named request_id, and submits the form. Your server reads request_id like any other field.

Hidden field Value
request_id The ID to send with the decision. Empty if collection failed.
request_id_error Why there is no ID (timeout, invalid_site_key, origin_not_allowed, …), for your own logs.

For forms you submit with script, call the tag yourself and add the ID to your request:

const { request_id } = await window.__dc.collect("signup");
await fetch("/api/signup", { method: "POST", body: JSON.stringify({ ...form, request_id }) });

collect(event) always resolves. When something fails it resolves with request_id: null and an error, after at most the timeout, so your flow carries on.

You can also attach a form you render later: window.__dc.attach(formElement, "checkout").

Set these as data- attributes on the script tag.

Attribute Default What it does
data-key required Your publishable site key.
data-endpoint v1/collect next to the script Where the tag posts. Set it only if you proxy the two paths differently.
data-field request_id Name of the hidden field it adds.
data-timeout 2500 Most milliseconds to wait before submitting anyway.
data-auto on off stops the automatic page view and form attach; call collect and attach yourself.
data-global __dc Name of the global the tag defines, if __dc clashes with something on your page.
data-agent-policy /.well-known/agent-policy.json Your agent policy, which the agent notice points to. See AI agents.

We recommend serving the tag and its endpoint from a path on your own domain, for example /c/. The device token is then stored first party, the tag shares your page’s certificate and origin, and content blockers treat it as part of your site.

Forward /c/ to the collector host with any reverse proxy. With Caddy:

handle_path /c/* {
reverse_proxy https://c.opencontext.com {
header_up Host {upstream_hostport}
}
}

With nginx:

location /c/ {
proxy_pass https://c.opencontext.com/;
proxy_ssl_server_name on;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Then load <script src="/c/t.js" …>. The tag posts to /c/v1/collect on its own.

Pass the client IP along in X-Forwarded-For. The decision also uses the ip your server sends, so the network on each decision is the end user’s even behind a proxy.

A live site key accepts collections only from the domains on the key: an exact host or any subdomain of one you list. Add them on the key in the console. A sandbox key with no domains accepts any origin, so local setup is quick.

If your pages send a Content-Security-Policy, allow the tag:

script-src 'self' https://c.opencontext.com;
connect-src 'self' https://c.opencontext.com;

With the first-party path, 'self' already covers both.

The tag never stands between a customer and your product. If the script is blocked, the network is slow, or the collector is down, the form still submits, and the decision returns with a no_request_id warning and a DEV_NOT_COLLECTED reason. Decide in your rules how much that matters for each event type.

Some cases count for more, because they are how fraud hides a device:

  • An unknown request ID, or one collected more than 30 minutes earlier, adds DEV_REQUEST_INVALID (warning request_id_not_found or request_id_expired). The tag makes a fresh one on every form submit, so pass the one from that submit.
  • A request ID already used for another account adds DEV_REQUEST_REUSED. Use each one for one decision; a retry for the same account is fine.
  • No collection on an account that normally has one adds DEV_COLLECTION_EXPECTED.
  • After a deny or a reported takeover on the account, a decision with no collection still steps up (HIST_BLOCKED_OTHER_DEVICE).

The tag runs on your pages, so your privacy and cookie notices should describe it. It keeps a signed device token on your own domain (a first-party cookie, local storage, and IndexedDB, for up to 400 days), reads browser, device, and network properties, and counts and times interaction, never what anyone types. It can recognize a returning device after storage is cleared, so say that plainly. Your server sends us the account ID, IP address, and, if you choose, email and phone, which become keyed tokens on arrival.

We process all of it for you as your service provider, only for fraud prevention and security, and never sell it or use it for advertising. Our cookie policy describes the tag, and we can send you model text for your notices. If your site is directed to children under 13, tell us before you add the tag.