Skip to content

Install with npm

Updated October 19, 2026

For apps built with a bundler, the statsdot package does what the script tag does, as a module you import.

npm install statsdot
import { init, track } from 'statsdot';

init({ domain: 'example.com' });

track('Signup');
track('Purchase', null, { revenue: 49.9, currency: 'EUR' });

Navigation with history.pushState, which most routers use, counts as a pageview automatically.

Options

Option Default
domain (required) The domain as added in Statsdot
apiHost https://statsdot.com Your own-domain proxy, for example https://example.com/sd
auto true Count outbound links and file downloads
scroll false Measure scroll depth; also turn it on in the site settings
props none Custom properties sent with every pageview
allowLocalhost false Send from localhost too, while testing

Like the script, the package sets no cookies, stores nothing on the device and sends nothing from automated browsers or when you excluded your own browser.