Skip to main content

Manual Installation

Time: ~5 minutes Requires: Access to your website's HTML source


Step 1: Copy your embed snippet

In your ConsentForge dashboard, go to Property → Embed and copy your snippet:

<script
src="https://cdn.consentforge.com/consentforge.min.js"
data-token="YOUR_EMBED_TOKEN"
data-position="bottom"
data-theme="auto"
defer
></script>

Step 2: Add it to your HTML

Paste the snippet before </head> — not at the bottom of <body>.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My Site</title>
<!-- ConsentForge — must be before any third-party scripts -->
<script
src="https://cdn.consentforge.com/consentforge.min.js"
data-token="cf_live_abc123"
defer
></script>
</head>
<body>
...
</body>
</html>
Order matters

The ConsentForge script must load before any third-party scripts (Google Analytics, Meta Pixel, etc.) for script blocking to work correctly.

Step 3: Mark third-party scripts for blocking

Add type="text/plain" and data-consent-category to any script you want blocked until consent is given:

<!-- BEFORE: loads immediately, ignores consent -->
<script src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"></script>

<!-- AFTER: blocked until user consents to "analytics" -->
<script
type="text/plain"
data-consent-category="analytics"
src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"
></script>

Category values:

ValueMeaning
necessaryAlways loads (no blocking)
analyticsLoads after analytics consent
marketingLoads after marketing consent
functionalLoads after functional consent

Step 4: Test

Open your site in an incognito window. The consent banner should appear before any blocked scripts load. Verify in DevTools → Network that blocked scripts don't appear until after consent.

Common examples

Google Analytics 4

<script type="text/plain" data-consent-category="analytics"
src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"></script>
<script type="text/plain" data-consent-category="analytics">
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXX');
</script>

Meta Pixel

<script type="text/plain" data-consent-category="marketing">
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){...}
fbq('init', 'YOUR_PIXEL_ID');
fbq('track', 'PageView');
</script>

YouTube Embed

<!-- Use data-src instead of src -->
<iframe
data-src="https://www.youtube.com/embed/VIDEO_ID"
data-consent-category="marketing"
width="560" height="315"
frameborder="0">
</iframe>