Install cookieless analytics on WordPress
Enqueue the built browser bundle in a WordPress child theme or a small site plugin. This is a manual installation guide, not an official WordPress analytics plugin.
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 packUpload the browser bundle
Copy dist/snippet.global.js into an assets directory in your child theme. Use your child theme so a parent-theme update does not remove the file. Back up the theme or work in staging before modifying code.
Enqueue it once
The following uses WordPress’s script enqueue and script-tag filter APIs. Add it to the child theme functions.php or adapt it to a site plugin. Replace the public key and API origin. The script-tag filter adds the public key and endpoint attributes; the browser bundle initializes from them.
Child theme functions.php
add_action('wp_enqueue_scripts', function () {
wp_enqueue_script(
'untitled-analytics',
get_stylesheet_directory_uri() . '/assets/snippet.global.js',
[], '0.1.0', true
);
});
add_filter('script_loader_tag', function ($tag, $handle) {
if ($handle !== 'untitled-analytics') return $tag;
return str_replace('<script ', '<script data-write-key="YOUR_SDK_WRITE_KEY" data-endpoint="https://api.your-domain.com" ', $tag);
}, 10, 2);Choose which pages to track
Standard WordPress page navigation works with the initial pageview. If your theme uses client navigation, add the router callback from the JavaScript guide. Decide whether to exclude logged-in administrators or preview pages using an explicit enqueue condition.
This snippet does not automatically import WooCommerce orders, record server purchases, or identify WordPress accounts. Implement those separately with a deliberate event contract.
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.