Skip to main content

JavaScript Installation

Install Told on any website by adding a script tag to your HTML.

1. Add the script

Paste the following snippet in the <head> of your HTML, before the closing </head> tag:

<script>
(function (w, d, e, v, o, l, t) {
w['ToldWidget'] = o;
w[o] = w[o] || function () { (w[o].q = w[o].q || []).push(arguments); };
w[o].l = 1 * new Date();
l = document.createElement(e);
t = document.getElementsByTagName(e)[0];
l.async = 1;
l.src = v;
t.parentNode.insertBefore(l, t);
})(window, document, 'script', 'https://scripts.told.club/sdk/sdk.js', 'told');

told('init', 'YOUR_SOURCE_ID');
</script>

Replace YOUR_SOURCE_ID with your Source ID from the Told dashboard (Settings > Installation).

tip

You don't need to copy this manually — the dashboard shows a ready-to-paste snippet with your Source ID already included.

2. Identify users (optional)

If your users are logged in, call identify after authentication:

<script>
told('identify', {
email: '[email protected]',
userId: '123',
name: 'Jane Doe',
});
</script>

3. Verify installation

  1. Visit your website
  2. Go to your source in the Told dashboard
  3. Click Verify installation

Or run in the browser console:

told('debug');

How it works

The snippet creates a lightweight queue function (told.q) and loads the SDK script asynchronously. Any calls to told(...) made before the script finishes loading are queued and replayed automatically once the SDK is ready. This means the snippet never blocks page rendering.