How to Exclude Your Own Visits from Analytics
Your own clicks pollute small-site data badly. Practical exclusion approaches for cookieless analytics, from localStorage flags to filters.
On a site doing a hundred visits a day, you and your cofounder checking the homepage after every deploy are a measurable percentage of 'traffic'. Small-site data is precious precisely because there is so little of it; polluting it with your own refresh habit distorts every conversion rate downstream. Classic tools solved this with IP filters — which cookieless analytics deliberately cannot use, since stable IP storage is what we are all avoiding. The alternatives are better anyway.
Method 1: the localStorage opt-out flag (recommended)
Set a flag once per browser, and have your event wrapper respect it:
// Run once in your browser console on the live site:
localStorage.setItem('analytics_optout', '1');
// In your site's event/tracking wrapper:
if (!localStorage.getItem('analytics_optout')) {
window.webanalytics?.track(name, props);
}Pragmatic, local, survives forever, and touches no visitor's data. Do it on every browser and device you use routinely — the phone counts.
Method 2: block dev and staging at the source
The bigger pollution source is usually localhost and staging. Gate the tag by environment so non-production never loads it:
// Next.js example — only render the script in production
{process.env.NODE_ENV === 'production' && (
<script defer src="https://clycyo.com/tracker.js"
data-tracking-id="..." />
)}Every framework guide on this blog (Hugo's IsProduction guard, Next.js, Laravel config) includes the per-stack version. Alternatively, use a separate tracking ID for staging so test data lands in a sandbox site instead of nowhere.
Method 3: accept the noise, measure around it
For very small sites, honesty: your visits are mostly homepage hits and dashboard checks. If you exclude dev/staging (method 2) and watch conversion events rather than raw pageviews — you presumably do not submit your own contact form daily — the practical distortion shrinks to rounding error. Many teams stop here, reasonably.
What not to do
- Do not ask for IP-based exclusion from a cookieless tool — a vendor that can filter your IP long-term is storing IPs, which is the wrong trade (why identifier-free matters).
- Do not block the tracker via adblock rules on your machine and forget you did — six months later you will debug 'broken analytics' that is just your own filter list.
Flag your browsers, gate your environments, and your small-site numbers become trustworthy enough to act on — which is the entire point of having them.