# Builder.io Site Tracking

This is an extremely simple NPM package that is meant primarily to be used with Unpkg's CDN to add quick tracking to the qwik version of our site.

## Building

```
$ npm install
$ npm run build
```

### Keys

At the moment we only use Amplitude's client directly, so only it's public API key is needed (it's hardcoded in `src/track.ts`).

## Publishing

Once you are properly authenticated with the `npm` CLI tool, just run:

```
$ npm publish
```

The version number will automatically increment the `version` present in the `package.json` file. The version number has to change every time we publish; NPM won't let us overwrite existing versions.

Then, add this script tag wherever needed

```
<script src="//cdn.builder.io/js/site-tracking@<VERSION>/dist/index.browser.js" async defer></script>
```

where `<VERSION>` is the version number in `package.json`. You can also use `latest` as the version identifier and have Unpkg figure which one to use.


Basically, `cdn.builder.io/js/*` proxies to `unpgk.com/@builder.io/*` with heavier caching and stale-while-revalidate caching mechanisms.
