Install cookieless analytics with JavaScript
Host the browser bundle or install a local SDK archive to collect pageviews and named events. Use the public SDK write key for your registered site.
Prepare the SDK from source
The SDK package is currently private and unpublished. Clone its repository and build the browser bundle. The source repository uses pnpm; application integration examples below use npm. Pin a reviewed commit for a production deployment.
Build the source and a local package archive
git clone https://github.com/yosriady/untitled-analytics-sdk.git
cd untitled-analytics-sdk
pnpm install
pnpm build
pnpm packOption 1: host the browser script
Copy dist/snippet.global.js to your website’s public assets. Add the script once before the closing body tag or in your shared document template. Replace both placeholders; the write key is public and scoped to your site.
HTML script tag
<script src="/snippet.global.js"
data-write-key="YOUR_SDK_WRITE_KEY"
data-endpoint="https://api.your-domain.com"
defer></script>Track a custom event
The browser script exposes window.untitledAnalytics after loading. Attach tracking to your application’s completed action, rather than logging every form keystroke.
After the script has loaded
window.untitledAnalytics?.track('signup_completed', { plan: 'starter' });Option 2: integrate with npm
Install the archive produced by pnpm pack into your application. Adjust its local path and version to the file you built.
Run in your application directory
npm install ../untitled-analytics-sdk/untitled-analytics-web-0.1.0.tgzInitialize in browser code
Create one instance for the application. Initial pageviews and popstate navigation are automatic by default. If your router uses pushState without popstate, call page after navigation or dispatch ua:navigate.
Browser initialization
import { createAnalytics } from '@untitled-analytics/web';
const analytics = createAnalytics({
writeKey: 'YOUR_SDK_WRITE_KEY',
endpoint: 'https://api.your-domain.com',
});
analytics.track('signup_completed', { plan: 'starter' });Verify pageviews and custom events
Register your actual site origin and use its public SDK write key. The endpoint is your deployed API origin, not a Tinybird URL. Open the published site, check that the bundle loads, and inspect successful collector requests and the project activity feed. Collection is queued, so allow for delivery latency.
Trigger a second page and a custom event. Confirm one expected pageview per navigation. Disable duplicate analytics installations. Identify an account only after login and clear the SDK user ID at logout. Review campaign fields, properties, and optional replay on a non-sensitive page first.
Frequently asked questions
Is the npm package public?
No. Build from source and install the local archive, or host the built browser bundle. Do not assume npm install @untitled-analytics/web resolves yet.
Which endpoint do I use?
Use your deployed analytics API origin, such as https://api.your-domain.com. Do not expose Tinybird or database credentials in browser code.
How do I check installation?
Verify bundle loading and successful collector requests, then inspect the project activity feed for the page and a named test event.