Nik Sharma
Analytics Pixel
Lightweight, privacy-conscious analytics for any website. Track page views, conversions, scroll depth, and user behavior with a single script tag. Under 5KB. Zero dependencies.
Installation
Step 1 — Add the script tag
<script src="https://pixel.nik.co/pixel.js" data-site="YOUR_SITE_ID"></script>Place this tag just before the closing </body> tag on every page you want to track. Replace YOUR_SITE_ID with the ID provided after site approval.
Step 2 — Track custom events (optional)
// Track a custom event
window.nk('event', 'signup_click', { plan: 'pro' });
// Track a conversion
window.nk('conversion', {
value: 49.99,
currency: 'USD',
order_id: '12345'
});Step 3 — Track CTA clicks (optional)
<!-- Add data-nk-track to any element -->
<button data-nk-track="buy_now">Buy Now</button>
<a href="/pricing" data-nk-track="pricing_link">View Pricing</a>What it tracks
Page Views
URL, referrer, title — every visit captured
Sessions
Anonymous visitor IDs, session management
UTM Parameters
Source, medium, campaign, term, content
Scroll Depth
25%, 50%, 75%, 100% thresholds tracked
Time on Page
Heartbeat every 5 seconds for accuracy
Click Tracking
Outbound links and data-nk-track CTAs
Conversions
Revenue, currency, order ID — the money data
Device Info
Type, browser, OS, screen resolution
Bounce Detection
Know who left without engaging
Return Visitors
New vs returning, automatically detected
API Endpoints
GET
/api/pixel.jsPOST
/api/eventsGET
/api/install-guidePOST
/api/sites