StatelessID

Asset Js

asset.js is the single JavaScript file served from statelessid.com. Add one script tag to your pages with your site key in data-k and it sends one visit beacon per page load.

The script tag

The full snippet is: <script src="https://statelessid.com/asset.js" data-k="YOUR_KEY" defer></script>. Place it in the <head> or before </body>. Keep defer. The defer attribute tells the browser to download the script in parallel with parsing the page and execute it after the document is parsed. Without defer, the browser halts parsing to execute the script immediately.

Your site key goes in data-k. You get the exact tag, with your key already filled in, from the Settings section of your dashboard. Navigate to Settings → Script tab for the site you want to instrument. Copy that tag and paste it into your template.

What fires on each page load

When the page reaches DOMContentLoaded, asset.js reads the current pathname, the referrer, the screen width, and a rough load timing from the performance API. It assembles one small beacon — under 500 bytes — and dispatches it once to statelessid.com. The script then exits.

Nothing is polled. Nothing runs on click, scroll, or visibility change. The script does not attach any ongoing event listeners. One load, one beacon, done. If you navigate to another page, the next page load triggers a fresh run of the script and a fresh beacon.

The hosted URL does not change

Always load from https://statelessid.com/asset.js. Do not copy the file and serve it from your own host. The hosted file is the current version. When the beacon format or the class boundaries are updated, the hosted file changes and every site that loads it from the canonical URL receives the change automatically.

Self-hosting freezes an old version. If the beacon shape changes, the frozen copy continues sending the old shape, which may be rejected at the server or counted incorrectly. It also breaks any Content Security Policy rules tied to the canonical domain. See the canonical URL article for more detail.

Removing the script

To stop collecting visits for a site, remove the script tag from your template. The beacon stops on the next page load. There are no cookies, localStorage entries, or server-side opt-out flags to clear. Removal is complete when the tag is gone from the rendered HTML.

Visit counts already in the dashboard from before removal remain in the board. They are the aggregate history up to the point the script stopped. Removing the script does not delete historical counts.

Troubleshooting

If visits are not appearing in the dashboard, confirm that the site key in data-k matches the hostname you registered. The system rejects beacons whose key does not match the expected hostname. Open Dashboard → Settings → Script tab to find the exact tag for each site. Copy it directly rather than typing the key by hand.

If the script tag is present in your source but the Network panel shows no request to statelessid.com/asset.js, a browser extension or ad blocker may be blocking the request. Test in a private window with extensions disabled to confirm the script loads and the beacon fires.

If you are developing on localhost and want to test the script, register localhost as a separate site in Setup to get a key that accepts beacons from that hostname. A key issued for your production domain will reject beacons from localhost.

Similar pages