Marketing Tools to use in Funnel/Website - Cookie Banner
If you plan to use any of the following analytics tools, please refer to the codes provided in the document for proper setup.
TABLE OF CONTENTS
Facebook pixel
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
fbq('consent', 'revoke');
fbq('init', '{your-pixel-id-goes-here}');
fbq('track', 'PageView');
window.addEventListener('LCCookieConsentDoneFB',function(cookieConsent){
fbq('consent', cookieConsent.detail.fb)},!1)
</script>Google Analytics
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("consent", "default", {
ad_storage: "denied",
ad_user_data: "denied",
ad_personalization: "denied",
analytics_storage: "denied",
});
window.addEventListener(
"LCCookieConsentDoneGTag",
function (cookieConsent) {
if (cookieConsent.detail.gtag === 'grant'){
gtag("consent", "update", {
ad_storage: "granted",
ad_user_data: "granted",
ad_personalization: "granted",
analytics_storage: "granted",
});
}
},
!1
);
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID"></script>
<script>
gtag("js", new Date());
gtag("config", "TAG_ID");
</script>Google Tag Manager
<!-- Google Tag Manager -->
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("consent", "default", {
ad_storage: "denied",
ad_user_data: "denied",
ad_personalization: "denied",
analytics_storage: "denied",
});
window.addEventListener(
"LCCookieConsentDoneGTM",
function (cookieConsent) {
if (cookieConsent.detail.gtm === 'grant'){
gtag("consent", "update", {
ad_storage: "granted",
ad_user_data: "granted",
ad_personalization: "granted",
analytics_storage: "granted",
});
}
},
!1
);
</script>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
<!-- End Google Tag Manager -->Reading Cookie Categories
The below code is optional if you wish to read consent or categories user has accepted for other custom code or third party javascript
// Helper function to get consented categories
function getConsentedCategories() {
const categoriesCookie = document.cookie
.split('; ')
.find(row => row.startsWith('cookie-categories='));
if (categoriesCookie) {
// Convert cookie value to array
return categoriesCookie.split('=')[1].split(',');
}
return [];
}
// Helper function to check if category is allowed
function isCategoryAllowed(category) {
const categories = getConsentedCategories();
return categories.includes(category);
}
// Helper function to get cookie config
function getCookieConfig() {
const cookieConfig = document.cookie
.split('; ')
.find(row => row.startsWith('cookie-config='));
if (cookieConfig) {
return cookieConfig.split('=')[1]; // Returns: all, essential, or custom
}
return undefined; // Return undefined if user hasn't made a choice yet
}Important Notes:
The cookie categories are stored in the cookie-categories cookie
Categories are comma-separated (e.g., "essential,advertising,analytics")
Always check for initial consent when loading your marketing tools
Listen for consent change events to update tool settings
Remove any <noscript> tags as they may bypass consent checks
Was this article helpful?
Related articles
- Cookie Policy DetailsA cookie policy is a legal requirement for websites that use cookies or similar tracking technologies. It informs users about the types of cookies used, their purposes, and how users can manage their preferences. Here are some key components to include in a cookie policy. TABLE OF CONTENTS - 1. IncFunnels & Websites Builder
- Migration of existing domainsWe're excited to announce a smoother process for migrating your existing domains to CloudFlare with our latest release. Say goodbye to the hassle of deletions and re-additions – introducing One-Click Migration with Domain Connect! TABLE OF CONTENTS - Why is it good for you to migrate the domains - Funnels & Websites Builder
- How to Use the Cookie Consent Banner in Funnels & WebsitesTABLE OF CONTENTS - Setting Up the Cookie Consent Banner- 1. Enable the Banner - 2. Configure Button Actions - 3. Customize Cookie Preferences - Customizing the Cookie Consent Banner- General Settings - Advanced Settings - Layout Options - Customizable Text for Buttons and Popup - New: Region-BaseFunnels & Websites Builder
- Nested URL Paths Support GuideTABLE OF CONTENTS - Overview - How to Use Nested URL Paths - Path Validation and Restrictions - Best Practices - Conclusion Overview The Nested URL Paths feature allows you to create hierarchical URLs for your funnels, websites, and webinars using forward slashes (/) to represent site structure. InFunnels & Websites Builder