Installation
How to install the tracking code
After adding your website in the dashboard, you'll receive a tracking code. Here's how to properly install it on your website.
The Tracking Code
Your tracking code looks like this:
<script defer data-domain="yourdomain.com" src="https://purestats.io/pf.min.js"></script>
Where to Place the Code
Place this code in the <head> section of your website, just before the closing </head> tag:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
<meta charset="utf-8">
<!-- Other head content -->
<!-- PureStats Tracking Code -->
<script defer data-domain="yourdomain.com" src="https://purestats.io/pf.min.js"></script>
</head>
<body>
<!-- Your content -->
</body>
</html>
Understanding the Attributes
defer
The defer attribute ensures the script loads asynchronously without blocking page rendering. This means your website loads at full speed while the tracking script loads in the background.
data-domain
This attribute tells PureStats which domain to associate the tracking data with. Make sure it matches exactly what you entered when adding your site in the dashboard.
Important: The data-domain must match your registered domain exactly. If you registered example.com, use example.com - not www.example.com.
Script Size & Performance
The PureStats tracking script is less than 2KB gzipped, making it one of the lightest analytics solutions available. It won't affect your Core Web Vitals or page load speed.
HTTPS Requirement
The tracking script is served over HTTPS for security. Your website can be either HTTP or HTTPS - both work fine.