Docs / Script tag

Docs · By hand

Install with a script tag

At the end your app sends events and errors to Vinktar on one key, and identify() joins them to a person.

Before you start

@vinktarhq/browser (CDN). The browser SDK from a CDN, for pages with no build step. Plain JavaScript.

You need a Vinktar project. Replace vnk_pk_YOUR_KEY below with its public write key. The app shows the same snippets with your key filled in. No project yet? Create one free, no card needed.

A coding agent connected over MCP can do this install for you. It reads the install guide, fetches the key, wires identify, defines the events it adds and checks what arrived. Connect your agent.

Add the script tag

<script
  src="https://unpkg.com/@vinktarhq/browser/dist/vinktar.min.js"
  data-key="vnk_pk_YOUR_KEY"
  defer
></script>

<script>
  // After sign-in; on logout, window.vinktar.reset().
  window.addEventListener('load', () => {
    window.vinktar.identify('user_123', { email: 'dana@example.com' });
  });
</script>

Check it worked

Reload the page. Pageviews and uncaught errors need nothing more; window.vinktar has track, identify, reset and captureException.

Join events and errors to a person

Anonymous activity is kept under the device. The first identify() with a user id binds that device to the person, and everything before it resolves to them retroactively. A device binds once; call reset() on logout so the next person gets a fresh one. The full rules are in api.md.

Next