Privacy-Friendly Analytics, Zero Config
Vercel Web Analytics is cookieless, GDPR-compliant out of the box, and built right into the platform. If your Eleventy site is deployed on Vercel, you can turn it on in a couple of minutes.
Set Up Web Analytics
No tracking IDs, no build tooling, just a small script in your layout
Enable Analytics in Your Vercel Project
- Make sure your Eleventy site is deployed on Vercel
- Open your project in the Vercel dashboard and go to the Analytics tab
- Click Enable under Web Analytics
Add the Tracking Script to base.html
Eleventy outputs plain HTML, so you use Vercel's framework-agnostic snippet instead of a package. Add it right before </body> in src/_includes/layouts/base.html. The {% if client.isProduction %} guard skips it in local dev, where /_vercel/insights/script.js isn't served:
<!-- src/_includes/layouts/base.html -->
<body>
{% block body %}{% endblock %}
{% if client.isProduction %}
<!-- Vercel Web Analytics -->
<script>
window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>
{% endif %}
</body>Deploy and Verify
Commit your changes and push, or run a manual deploy:
vercel deploy --prodThat's It!
Visit your live site, then open the Analytics tab in Vercel, page views show up within about 30 seconds. Note that data is only collected on production deployments, so you won't see anything from localhost.
Track Custom Events
Measure signups, form submissions, and other conversions
The script registers a global window.va queue. Call it from any event handler, guard with window.va so nothing throws in local dev where the script isn't loaded:
<button id="signup">Sign Up</button>
<script>
document.getElementById("signup")?.addEventListener("click", () => {
window.va && window.va("event", { name: "Signup", data: { plan: "pro" } });
});
</script>Custom events require a Vercel Pro or Enterprise plan. The first argument is always "event"; the object holds the event name and optional data.
Bonus: Add Speed Insights
Track real-world Core Web Vitals from your actual visitors
Speed Insights is a separate, equally simple add-on. Enable it under the Speed Insights tab in your Vercel project, then add its script alongside the analytics snippet in base.html:
<!-- src/_includes/layouts/base.html, before </body> -->
{% if client.isProduction %}
<!-- Vercel Web Analytics -->
<script>
window.va = window.va || function () { (window.vaq = window.vaq || []).push(arguments); };
</script>
<script defer src="/_vercel/insights/script.js"></script>
<!-- Vercel Speed Insights -->
<script>
window.si = window.si || function () { (window.siq = window.siq || []).push(arguments); };
</script>
<script defer src="/_vercel/speed-insights/script.js"></script>
{% endif %}📋 Privacy Considerations
- • Vercel Web Analytics is cookieless, no cookies, no cross-site tracking
- • Compliant with GDPR, CCPA, and PECR by default, so a consent banner usually isn't required
- • Visitor data is anonymized and never used to build personal profiles
- • It's still good practice to mention analytics in your privacy policy
You're All Set!
Vercel Analytics is now tracking your visitors. Check the Analytics tab to see real-time data.
