Quickstart
Install the tracker in a couple of minutes, check that data comes in, then send your first custom event.
1. Get your project ID
In the Sublim dashboard, open your project and go to Settings → Installation. The snippet shown there already contains your project ID, a UUID such as 01a0fc6e-4e52-783c-8287-e15ec81f22e1.
2. Add the snippet to every page
Paste the snippet in the <head> of your site's shared layout or template, so it runs on every page, once:
<script>
(function(){
window.sublim=window.sublim||function(){(sublim.q=sublim.q||[]).push(arguments)};
sublim.o={projectId:'YOUR_PROJECT_ID'};
var d=document,s=d.createElement('script');
s.src='https://cdn.sublimanalytics.com/loader.js';s.async=1;
d.getElementsByTagName('head')[0].appendChild(s);
})();
</script>
The script is loaded asynchronously and never blocks rendering.
sublim.oholds the configuration options.projectIdis the only one you need.- The first line creates a small
window.sublimstub, so calls made before the script has downloaded are kept and sent once it is ready. See Calling before the script loads.
Using React, Next.js, Vue, WordPress…?
The same snippet works everywhere, but each stack has a natural place for it. See Frameworks & CMS, or install with npm if your app bundles its dependencies.
3. Check that data arrives
Deploy, then open your live site in a normal browser window. Within a few seconds the visit shows up in the dashboard's Real-time view.
Nothing is tracked on localhost
By default the tracker stays off on localhost, 127.0.0.1 and [::1], so your development traffic doesn't pollute your statistics. To test locally, add trackLocalhost: true to sublim.o in your development environment only:
sublim.o = { projectId: 'YOUR_PROJECT_ID', trackLocalhost: true };
To see what the tracker does, add debug: true to sublim.o and open the browser console.
4. Send a custom event
Pageviews, engagement, form leads, downloads and e-commerce are tracked automatically. For anything specific to your product, call trackEvent where the action succeeds:
sublim.trackEvent('appointment_cancelled', {
props: { reason: 'customer_request' },
});
- Event names are free-form. Prefer
snake_case, and keep the same name everywhere the action can happen. - Properties go inside
props. Keep them flat (strings, numbers, booleans) and never send personal data such as names, emails or phone numbers.
The event appears in the dashboard under Custom Events, where you can use it in KPIs, funnels and goals.