Skip to main content
TayStack

Quick start

Add the TayStack script to your site, where to put it, and how to check in your browser that events are being received.

1. Add your site

Sign in, open Sites, and use the Add a site form with your domain. Open the site and the Install card shows the snippet with your own site id, and a Copy snippet button. Sign-up is not open yet: join the waitlist on the home page and we will email you when your invite is ready. Existing accounts can sign in.

2. Paste the snippet

This is the line the Install card generates, with a placeholder site id and domain. Use the one from your dashboard, not this one.

HTML
<script defer data-website-id="site_abcd1234efgh" data-domain="example.com" src="https://www.taystack.com/js/script.js"></script>

Put it inside <head> on every page of your site, once. It uses defer, so it does not block rendering. The attributes:

  • data-website-id: your site id. Required.
  • data-domain: the domain you registered. Required. The script only sends events from that domain, its www. form and its subdomains.
  • data-allow-localhost: set to true to also track localhost, 127.0.0.1 and [::1]. See Troubleshooting.
  • data-api-url: where events are sent. Only needed with a proxy. See Proxy setup.
  • data-track-outbound: optional. Sends an outbound_click event when a visitor clicks a link to another site (the address without its query string or fragment). A leading www. is ignored; other subdomains count as outbound. Present with any value turns it on; "false" turns it off.
  • data-track-downloads: optional. Sends a file_download event with the file path and extension when a visitor clicks a link to a common download type (for example pdf, zip, docx, xlsx, csv, mp3, mp4).

Note: If data-website-id or data-domain is missing, the script does nothing and says nothing. It never throws into your page.

3. Check that it works

  1. Open a page of your site (on your real domain, not localhost).
  2. Open your browser developer tools, go to the Network tab and filter by events.
  3. Reload. You should see a POST request to /api/events with status 202.
  4. Open your site in the dashboard. The visitors-now count updates about every 15 seconds; refresh the rest of the dashboard to see the visit in the totals.

What 202 means: The endpoint answers 202 to any well-formed request, including one for an unknown site id and one from a bot. So 202 shows the request arrived, not that the event was stored. If the dashboard stays empty, see Troubleshooting.

What happens next

  • The script sends a pageview when a page loads.
  • Route changes in single-page apps are recorded too: Single-page apps.
  • Your own events: Custom events.