Introduction #
Managing multiple domains with a single Content Management System (CMS) can streamline your workflow and simplify content management. This documentation will guide you on how to configure your cookie banner for multiple domains through one cms.
Multisite CMS Overview #
A multisite CMS allows you to manage several websites from a single installation. This can be particularly useful if you have related websites that share content or functionality. Popular multisite CMS platforms include:
- Typo3
- WordPress Multisite
- Magento
Setting Up Multiple Domains #
If you are using a multisite CMS and do not have the ability to set up scripts for each separate domain, you will need to modify the embed script for the multiple domains connected to your CMS. Below, we provide an example of how to prepare an embed script for three domains:
Example Embed Script #
var hostname = window.location.hostname;
var script = document.createElement("script");
var apiKey = '';
// use domain.com, without https://
// to get correct value, take the output of window.location.hostname in dev tools on that domain
if (hostname === ' Your Domain A') {
apiKey = 'Api key of the domain A';
} if (hostname === 'Domain B') {
apiKey = 'Api key of domain B';
} else if (hostname === 'Domain C') {
apiKey = 'Api key of domain C';
}
script.src="https://consent.cookiefirst.com/sites/" + hostname + "-" + apiKey + "/consent.js";
document.head.appendChild(script);
Considerations #
When configuring your embed scripts, be mindful of the following considerations:
- Ensure that each domain is properly configured in your CMS settings.
- Be aware of how users will navigate between domains.
- Test to verify that the scripts behave as expected for each domain.