Fast Free Cookie Consent with Silktide for Side Projects
Fast, Free Cookie Consent For Your Side Project
Microsoft Clarity needed consent. Another thing for the endless TODO list when all I want to do is ship.
Found a free, open-source consent manager from Silktide. No account, no credit card, just a simple javascript snippet. Took me like 15 minutes to get working.
A couple quick tips if you use it:
- Avoid Ad-blockers. Ad-blocker's are aggressive and block anything with "consent" or "cookie" in the name. Rename the
.js
file to something generic likecs.js
. - Script Placement. Put the script tag at the end of your
<body>
, not in the<head>
. - For Next.js builders. The init script has to run client-side. Make sure you call it inside a
useEffect
hook. Took me a min to figure that one out. - Tell Clarity. You need to actually tell Clarity about the user's choice. Hook this into the Silktide callbacks. It looks something like this:
if (typeof window.clarity === "function") {
window.clarity('consent', true)
window.clarity('consentv2', {
ad_storage: "granted",
analytics_Storage: "granted"
});
}
Saved me a ton of headache so I could get back to building. Hope this helps.
This article was originally published on https://craftengineer.com/. It was written by a human and polished using grammar tools for clarity.
--
Follow me on X (Formally, Twitter). Or read my stories on engineering management, and how to be a better engineering leader on Vibe Manager Blog.