Analytics

OneDollarStats

OneDollarStats matches events to the domain registered in your dashboard, so no API key is needed. This helper loads its classic deferred script after measurement consent and forwards settings as data-* attributes.

Integrate with c15t

import { type ReactNode } from 'react';
import { ConsentManagerProvider } from '@c15t/react';
import { oneDollarStats } from '@c15t/scripts/one-dollar-stats';

const scripts = [oneDollarStats()];

export function ConsentProvider({ children }: { children: ReactNode }) {
  return (
    <ConsentManagerProvider
      options={{
        mode: 'hosted',
        backendURL: 'https://your-instance.c15t.dev',
        scripts,
      }}
    >
      {children}
    </ConsentManagerProvider>
  );
}

Tracker settings

All settings use strings and omit the data- prefix. Unknown settings are forwarded for compatibility with future tracker options.

oneDollarStats({
  hostname: 'docs.example.com',
  devmode: 'true',
  autocollect: 'false',
  'hash-routing': 'true',
  url: 'https://analytics.example.com/events',
})
  • hostname must be a bare hostname, optionally including a port. It overrides the event hostname on every host, including production.
  • Local testing needs both hostname and devmode: 'true'.
  • autocollect: 'false' disables automatic pageview and click collection.
  • 'hash-routing': 'false' omits the attribute entirely: the CDN tracker enables hash routing whenever the attribute is present, regardless of its value.
  • url overrides the collection endpoint. Leave it unset to use the vendor default.

The tracker handles browser history navigation itself; no extra router hook is required. See the vendor installation reference for its settings.

The script uses the measurement category and loads only when that consent is granted. On revocation, c15t removes its script element. Removing a script does not undo code that already executed, including the tracker's history hooks and event listeners. Use c15t's reload-on-revocation behaviour to clear the running tracker, and check measurement consent before making manual tracking calls.

Types

OneDollarStatsOptions

Warning: ExtractedTypeTable: Could not extract "OneDollarStatsOptions" from "./packages/scripts/src/vendors/analytics/one-dollar-stats.ts" using base path "/vercel/path0/apps/c15t-docs/.leadtype/c15t". Verify the path/name and that the file is included by your tsconfig.

Loading…

Script

Warning: ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/vercel/path0/apps/c15t-docs/.leadtype/c15t". Verify the path/name and that the file is included by your tsconfig.

Loading…