1つのCMSで複数のドメインを利用する
Typo3、Wordpress Multisite、MagentoなどのマルチサイトCMSシステムを使用していて、ドメインごとにスクリプトを設定する機能がない場合、複数のドメインを接続している場合は、埋め込みスクリプトを修正する必要があります。
以下のスクリプトを例として、3つのドメインを設定します。
<script>
var hostname = window.location.hostname;
var script = document.createElement("script");
script.src="https://consent.cookiefirst.com/banner.js";
// use domain.com, without https://
// to get correct value, take the output of window.location.hostname in dev tools on that domain
if(hostname === 'domain1.com') {
script.setAttribute('data-cookiefirst-key', "API KEY HERE");
}else if(hostname === 'domain2.com') {
script.setAttribute('data-cookiefirst-key', "API KEY HERE");
}else if(hostname === 'domain3.com') {
script.setAttribute('data-cookiefirst-key', "API KEY HERE");
}
document.head.appendChild(script);
</script>


