---
title: "Add Togo to a plain HTML site"
description: "Load the browser SDK as a JavaScript module on a site with no build step."
canonical: "https://www.togohq.ai/docs/html"
applies_to: "@togohq/sdk-browser 1.x"
updated: "2026-11-03T00:00:00Z"
---

# Add Togo to a plain HTML site

Load the browser SDK as a JavaScript module on a site with no build step.

The SDK is an ES module, so a site with no bundler loads it straight from a CDN with
`<script type="module">` — one snippet, no build step.

## Add the snippet

Put this in the `<head>` of every page, with your write key — the **test** key (`togo_pkt_…`)
while you build, the **live** key (`togo_pkl_…`) on the published site. Write keys are public and
can only send events.

```html
<script type="module">
  import { init } from 'https://esm.sh/@togohq/sdk-browser@1';

  const analytics = init({ writeKey: 'togo_pkt_your_test_key' });
  analytics.track('page_viewed');
  window.togo = analytics;
</script>
```

Each page load sends one `page_viewed`, carrying the page's URL, path, referrer and campaign.
The query string and `#fragment` are never sent.

## Track a click

```html
<button onclick="window.togo?.track('signup_clicked', { location: 'hero' })">Sign up</button>
```

Module scripts run after the page is parsed, so `window.togo` is undefined for the first instant
of a page load; the `?.` makes an early click a no-op rather than an error.

## Pin the version

`@1` follows every 1.x release. To pin an exact version, use `@togohq/sdk-browser@1.1.1`, and check
[the changelog](/changelog) before you move it.

## Check it works

Open the page, click around, and confirm the events arrived: [Check that events
arrive](/docs/verify).
