CControxity Docs
GuidesReferenceHTTP APIOpen Controxity
Platforms

Browser

A web page's errors, with a browser key that can only send.

1. Get a browser key#

Add the page's place under Where it runs (What is it? → Web). Under Setup, press Make a browser key: it shows the two lines for your page, with the key in them. A browser key starts with pub_ and can only send, so it's safe in a page. (Later, Change → Browser key makes a new one.)

Never put a server key (dep_…) in a page. init refuses one.

2. Add it to your page#

<script src="https://controxity.example.com/sdk/controxity.js"></script>
<script>
  controxity.init({ key: "pub_…", url: "https://controxity.example.com", version: "1.4.2" });
</script>

Put them in your HTML before your own scripts. The first line loads the SDK from your Controxity (or save that file with your site and load it from there). Set version to your build's version or git commit.

Uncaught errors and failed promises are now reported. The rest of the page is untouched. If the key is refused (replaced, or the licence ended), the page sends nothing more; the next page load tries once again.

Also useful#

controxity.captureError(error);                         // an error you caught
controxity.event("signup");                             // counted
controxity.report({ title: "Can't pay", what: text });  // what a visitor told you

What's sent#

An error's type and where it happened. Error messages, form contents and the query part of addresses never leave the page, except what you pass to report.

Minified code#

A built page reports minified places (main.3f9c2a1b.js:1:23456). Send your build's source maps to Controxity when you deploy, and each error is translated back to your own files and lines: see Send source maps. The maps stay with Controxity and are never served.

Busy sites#

A browser key takes 60 sends a minute. With more visitors than that, Controxity tells the page which share of visitors should send. The others send nothing, and Controxity scales the counts back up, so the numbers stay right. To set the share yourself: Where it runs → the place → Change.

Would rather the page only talk to your own server?#

Have the page send its errors to your server, and relay them from there with your server's key. Nothing is loaded from Controxity, and no key is in the page: see Phone apps, which works the same for web pages (platform: "web").

Controxity 1.132.0These pages are in the repository: docs/site