Search
Close this search box.

Add a Cookie Policy link to the AMP banner

Complianz dynamically adds a link to the Cookie Policy within the Cookie Banner by using JavaScript. However, since JavaScript is not supported on AMP, this link will not automatically be added to the Cookie Banner on AMP pages.  This article describes the steps to insert a Cookie Policy link that is only displayed on AMP pages.

Install and configure both Complianz and AMP

Make sure that both Complianz and AMP have been installed and fully configured. In this example, we are using AMP in Transitional Mode.

Add the Cookie Policy link

Navigate to Cookie Banner > Edit > Banner Settings > Cookie message. We use an HTML element and attach a class, so we can modify this element with CSS. The class name “cmplz-amp-link” is used in the HTML below:

Add CSS to toggle the Cookie Policy link

The element should only be displayed on AMP pages, not on “normal” pages. Navigate to Appearance > Customize > Additional CSS, and add the CSS below:

The result

The created element/link will only be shown on the AMP version of the Cookie Banner.

AMP Banner including the Cookie Policy link

Styling the AMP Cookie Banner

By default, the buttons and text in the AMP Cookie Banner look a little more basic. To apply the same styles to the AMP Banner as shown in the example image above, use the code below:

Join 1M+ users and install The Privacy Suite for WordPress locally, automated or fully customized, and access our awesome support if you need any help!

Complianz has received its Google CMP Certification to conform to requirements for publishers using Google advertising products.