Skip to main content

Installation

Installing the Sealmetrics tracker adds cookieless, consentless analytics to your site — it fires the initial pageview automatically and exposes the sealmetrics object for tracking conversions and microconversions. The method is a single <script> tag with your Site ID, placed in your page's <head>.

Basic Installation

Add this script tag to your HTML, preferably in <head>:

<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID" defer></script>

Replace YOUR_SITE_ID with your Sealmetrics Site ID (found in Settings → Sites → [your site]).

The defer attribute ensures the script loads asynchronously without blocking page rendering.

With Content Grouping

Content grouping categorizes pages into sections for analysis (e.g., "blog", "product", "checkout").

Add the group parameter:

<!-- Blog pages -->
<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID&group=blog" defer></script>

<!-- Product pages -->
<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID&group=product" defer></script>

<!-- Documentation pages -->
<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID&group=docs" defer></script>

<!-- Checkout flow -->
<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID&group=checkout" defer></script>

Content grouping enables reports like:

  • Conversions by content group
  • Bounce rate per section
  • Traffic distribution across page types

Custom Endpoint

For self-hosted deployments or custom domains:

<script src="https://your-pixel-domain.com/t.js?id=YOUR_SITE_ID" defer></script>

Parameters Reference

ParameterRequiredDescriptionExample
idYesYour Sealmetrics Site IDid=67a1d6c0bb10b861397fdd3a
groupNoContent grouping for this page. Must match ^[a-zA-Z0-9_-]{0,64}$; an invalid value makes /t.js return HTTP 400group=blog
autoNoSet auto=0 to suppress the automatic initial pageview (manual mode). Any other value keeps it onauto=0

Manual Pageview Mode (auto=0)

By default the tracker fires the initial pageview as soon as it loads. Add auto=0 to keep everything wired up (SPA listeners, conv(), micro()) while firing the pageview yourself — useful when you need to set a content group after your dataLayer is ready:

<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID&auto=0" defer></script>
<script>
window.addEventListener('load', function () {
sealmetrics({ group: 'checkout' });
});
</script>

Deferred Loading / GTM (pre-load queue)

If a sealmetrics(...) call may run before the library finishes loading (e.g., Google Tag Manager), inject this fbq-style stub before the script tag. It buffers calls in sealmetrics.q and replays them once the library boots:

<script>
!function(w){w.sealmetrics=w.sealmetrics||function(){(w.sealmetrics.q=w.sealmetrics.q||[]).push(['pv',arguments])};w.sealmetrics.q=w.sealmetrics.q||[];w.sealmetrics.conv=w.sealmetrics.conv||function(){w.sealmetrics.q.push(['cv',arguments])};w.sealmetrics.micro=w.sealmetrics.micro||function(){w.sealmetrics.q.push(['mc',arguments])}}(window);
</script>

When using the stub to enqueue a pageview, load the tracker with auto=0 so the queued pageview and the automatic one do not both fire. See the API Reference for details.

What Happens After Installation

  1. The script loads asynchronously (does not block rendering)
  2. A session ID is generated automatically without cookies
  3. An anti-spam token is validated (embedded in the script, valid for 24 hours)
  4. The initial pageview is tracked automatically
  5. SPA navigation is detected automatically (History API)

Verifying Installation

Option 1: Browser Console

Open DevTools (F12) and type:

typeof sealmetrics === 'function'
// Should return: true

Option 2: Network Tab

  1. Open DevTools > Network
  2. Filter by "event"
  3. Reload the page
  4. Look for a POST request to /event with status 204

Option 3: Inspect Tracker State

In the console you can read the tracker's own state to confirm it initialized correctly:

sealmetrics.sessionId; // current session ID
sealmetrics.accountId; // your site ID
sealmetrics.autoMode; // "1" (auto-pageview) or "0" (manual mode)

Common Installation Patterns

WordPress (without plugin)

Add to header.php or use a "Header Scripts" plugin:

<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID" defer></script>

Next.js

In app/layout.tsx or pages/_app.tsx:

import Script from 'next/script';

export default function RootLayout({ children }) {
return (
<html>
<head>
<Script
src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID"
strategy="afterInteractive"
/>
</head>
<body>{children}</body>
</html>
);
}

Nuxt.js

In nuxt.config.ts:

export default defineNuxtConfig({
app: {
head: {
script: [
{
src: 'https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID',
defer: true
}
]
}
}
});

Google Tag Manager

  1. Create a new Custom HTML tag
  2. Paste:
<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID" defer></script>
  1. Set trigger to "All Pages"
  2. Publish

Shopify

  1. Go to Online Store > Themes > Edit code
  2. Open theme.liquid
  3. Add before </head>:
<script src="https://t.sealmetrics.com/t.js?id=YOUR_SITE_ID" defer></script>

Troubleshooting

Script not loading

  1. Check that YOUR_SITE_ID is replaced with your actual Site ID
  2. Verify the site is active in Sealmetrics dashboard
  3. Check browser console for errors

Events not appearing in dashboard

  1. Events are processed in batches; wait 2-5 minutes
  2. Verify the domain is registered in Settings → Sites → [your site] → Domains
  3. Check if adblockers are blocking requests (unlikely with first-party setup)

204 response but no data

The server returns 204 for all requests (valid or rejected) to prevent information leakage. Check:

  1. Site ID is correct
  2. Domain is authorized for this site
  3. Token is valid (script was loaded less than 24 hours ago)

Need help with installation? Contact us at support@sealmetrics.com or start your free trial.