Automad automatically displays a cookie consent banner when a page includes embedded third-party content, such as YouTube videos, SoundCloud embeds, social media posts, or similar elements. This ensures your site remains GDPR compliant.
Custom Script Wrapper
For third-party scripts that aren't automatically handled, you can use the am-consent wrapper component to request visitor consent before loading the script.
The am-consent component can handle both, linked .js files as well as inline JavaScript code.
Inline JavaScript can be added to a custom HTML field as follows:
<am-consent type="script">
console.log('Hello you!');
</am-consent>
To fetch and run an externally linked script file, you can use the src attribute:
<am-consent type="script" src="https://domain.com/script.js"></am-consent>
Styling the Cookie Banner
Automad lets you customize the consent banner via the dashboard:
- Change the banner text and button labels
- Adjust background and text colors
- Change the colors of the embedded content placeholders
This way, the banner and placeholders feel like part of your design, not a foreign element. All cookie consent customization settings can be found either in General Data and Files > Customizations section or under the Customizations tab in the page settings.