Skip to main content

Add the script on your own site

Plain HTML, Next.js, Astro and other sites you build yourself.

About 10 minutesYou need: access to your code
On this page

Plain HTML or Astro

Paste the line in your shared layout, before </head>.

Your line
<script async src="https://YOUR-LINK-DOMAIN/t.js" data-key="mk_YOUR_KEY"></script>

Next.js

app/layout.tsx
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <head>
        <script async src="https://YOUR-LINK-DOMAIN/t.js" data-key="mk_YOUR_KEY" />
      </head>
      <body>{children}</body>
    </html>
  );
}

Pick the forms to track

Add one attribute to a form. The value is its name in your reports.

A tracked form
<form data-totems="apply" action="/apply" method="post">
  <input name="email" type="email" autocomplete="email">
  <button>Send</button>
</form>

The script adds the visitor id in a hidden field named tm_v. It reads email, phone and name only. data-totems="off" turns a form off.

Tell us who sent a form

Call this after your server says the form was saved:

After a form is saved
totems.identify({ email: 'alex@example.com', name: 'Alex' })

You can also send phone in international form, such as +14155550123. This is a claim, not proof. It can't replace a person who is already joined to that browser. A payment, or a call from your server, is stronger.

Send a custom event

A custom event
totems.track('joined_webinar')

Browser events are marked unverified. They can never make a sale. Send sales from your server with the Sales API.

Pass the id yourself

totems.visitor() gives the visitor id, or null without consent. totems.url('https://...') adds it to a booking or checkout address. totems.status() helps you check the setup.

Content security policy

If your site uses one, allow your link domain in script-src and connect-src.

How to know it worked

Press Check my site in Settings, then Script.

Was this useful?

Your answer stays in this browser.