How to Block or Allow Scripts Manually
CookieForte offers two methods to manually control script categories and their blocking behavior. This guide covers both approaches to give you complete control over cookie consent management.
Method 1: Using the CookieForte Platform (Recommended)
The platform interface provides an intuitive way to manage script categories without code modifications.
Setting Up Manual Script Blocking
- Navigate to Websites and Banners
- Access your CookieForte dashboard
- Select the banner you want to configure
- Click on "Settings"
- Set script blocking mode to "Manual"
- Manage Script Categories
- Navigate to the "Scripts" section
Script Category Types
In the Scripts section, you can assign each detected script to one of four categories:
Do Not Block
- Scripts in this category will always load regardless of user consent
- Use for essential functionality scripts that don't track users
- These scripts are never blocked by the cookie banner
Preferences
- Scripts are blocked until users explicitly consent to the Preferences category
- Typically used for scripts that enhance user experience or save user settings
- Only load after user grants preferences consent through your banner
Statistics
- Scripts remain blocked until users agree to allow Statistics cookies and tracking
- Used for analytics scripts, performance monitoring, and usage statistics
- Require explicit statistics consent from users
Marketing
- Scripts are blocked until users consent to Marketing cookies and advertising tracking
- Used for advertising scripts, retargeting pixels, and marketing analytics
- Require explicit marketing consent from users
Method 2: Direct JavaScript Code Implementation
This advanced method provides granular control by modifying script tags directly in your HTML code.
Implementation Steps
- Modify Script Type
- Change type="text/javascript" to type="text/plain"
- This prevents the script from executing automatically
- Add Category Attribution
- Include data-cookieconsent attribute with your desired category
- Choose from: preferences, statistics, or marketing
Code Examples
Preferences Script:
<script type="text/plain" data-cookieconsent="preferences"> console.log('This is preferences script'); </script>
Statistics Script:
<script type="text/plain" data-cookieconsent="statistics"> console.log('This is statistics script'); </script>
Marketing Script:
<script type="text/plain" data-cookieconsent="marketing"> console.log('This is marketing script'); </script>
Best Practices
- Use Platform Method First: The CookieForte platform interface is recommended for most users as it's more user-friendly and doesn't require code changes
- Test Thoroughly: Always test your consent flow after implementing manual script blocking
- Document Changes: Keep track of which scripts are assigned to which categories for future reference
- Regular Audits: Periodically review your script categorizations to ensure they align with privacy regulations
When to Use Each Method
Choose Platform Method When:
- You prefer a visual interface
- You want to avoid code modifications
- You need to manage multiple websites centrally
- You're not comfortable with HTML/JavaScript
Choose JavaScript Method When:
- You need very specific, granular control
- You're implementing custom consent logic
- You have complex script dependencies