Dev.to
7/22/2026

Add Microsoft Clarity to Hugo with Cloudflare Zaraz - Without Redeploying
Short summary
This tutorial shows how to add Microsoft Clarity analytics to a Hugo site hosted on Cloudflare Pages using Cloudflare Zaraz, eliminating the need to rebuild or redeploy when enabling or disabling tracking. Since Clarity may not appear in Zaraz's native catalog, you add it as a Custom HTML tool triggered on pageview. The guide also covers CSP considerations, consent management integration, and Clarity's three masking modes for privacy compliance.
- •Use Cloudflare Zaraz to manage Clarity tracking without modifying Hugo templates or redeploying
- •Add Clarity as a Custom HTML tool with Pageview trigger since it may not be in Zaraz's native catalog
- •Configure consent management and masking modes to avoid bypassing privacy requirements
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



