Getting Started

Install the tracking script

Add the Otus tracking snippet to the head of your website to start collecting data.

Otus collects data through a single lightweight script. Add it once to every page you want to measure. The best place is inside the <head> so it loads early.

Add the snippet

Copy your snippet from Site settings → Tracking snippet and paste it just before the closing </head> tag:

index.html
<!doctype html>
<html>
  <head>
    <!-- ... your other head tags ... -->
    <script async src="https://cdn.otusanalytics.com/otusanalytics/otus.js"></script>
    <script>
      window.otus=window.otus||function(){(otus.q=otus.q||[]).push(arguments)},otus.init=otus.init||function(i){otus.o=i||{}};
      otus.init({ siteId: 123, endpoint: "https://ingest.otusanalytics.com/e" })
    </script>
  </head>
  <body>
    <!-- ... -->
  </body>
</html>

Replace siteId: 123 with your site ID. Everything else can stay as-is.

The first line loads the tracker. The second defines otus() right away, so calls like otus('track', ...) or otus('setConsent', ...) work anywhere on the page, even before the tracker has finished loading: they're queued and sent once it has.

The script loads async and is under 4 KB, so it won't block rendering or slow your page down.

Options

Pass these to otus.init({ ... }):

OptionRequiredDescription
siteIdYesYour numeric site ID. Without it, tracking is skipped.
endpointNoIngestion URL. Defaults to https://ingest.otusanalytics.com/e.
trackingModeNo"cookieless" (default) or "full". See Tracking modes.
hashNotrue for hash-based routing (/#/about), see Single-page apps.
consentDefaultNo"granted" to treat unanswered consent as granted, for sites that don't need a consent banner. See consent.
consentWaitNoHold the first pageview up to this many milliseconds (max 10000) for your consent banner to call otus('setConsent', ...).
trackLocalhostNotrue to also track visits on localhost, for testing.

Enabling full tracking

Cookieless is the default. To enable full tracking (which enables returning-visitor metrics), add trackingMode: "full":

otus.init({ siteId: 123, endpoint: "https://ingest.otusanalytics.com/e", trackingMode: "full" })

Single-page apps (SPAs)

You don't need to do anything extra. The tracker automatically records a pageview on the initial load and on every client-side route change to a new path (pushState and back/forward navigation), so frameworks like Vue, React, Svelte and Angular work out of the box. Query-string changes, #anchor links and redirects via replaceState aren't counted as new pageviews.

If your app uses hash-based routing (URLs like /#/about), add hash: true to otus.init(). Hash changes are then tracked as pageviews, with the hash included in the page path.

Opting yourself out

To stop the tracker recording your own visits in a browser, run this in the console once:

localStorage.setItem("otus_ignore", "true");

Next step

Once the snippet is live, verify your installation. Using a tag manager or CMS instead? See the integration guides.