Integration Guides

Script tag (add to <head>)

[object Object]

Adding the script tag directly to your HTML is the most reliable way to install Otus. It works on every platform that lets you edit the page <head>.

Steps

  1. In the Otus dashboard, open Site settings → Tracking snippet and copy your snippet.
  2. Paste it just before the closing </head> tag on every page of your site.
  3. Deploy your site.
  4. Verify the installation.
index.html
<head>
  <!-- ... -->
  <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>
Use a shared layout/template so the snippet appears on every page automatically, rather than pasting it page by page.

Next.js (App Router)

Add both parts in app/layout.tsx using next/script:

app/layout.tsx
import Script from 'next/script'

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <Script src="https://cdn.otusanalytics.com/otusanalytics/otus.js" strategy="afterInteractive" />
        <Script id="otus-init" strategy="afterInteractive">
          {`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>{children}</body>
    </html>
  )
}

Nuxt

Add it in nuxt.config.ts so it renders into the head on every page:

nuxt.config.ts
export default defineNuxtConfig({
  app: {
    head: {
      script: [
        { src: 'https://cdn.otusanalytics.com/otusanalytics/otus.js', async: true },
        {
          innerHTML: `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" })`
        }
      ]
    }
  }
})

Plain HTML / static sites

Paste the snippet into the shared <head> of your template or include file. If you use a static site generator (Hugo, Eleventy, Astro, Jekyll), add it to the base layout.

Single-page apps

No extra setup is needed. Otus automatically tracks pageviews on initial load and on every client-side route change. See Install the tracking script.

Next step

Verify your installation, then explore your reports.