Add a Cookie Policy link to the AMP banner

Get compliant today in the European Union, United States, Canada, United Kingdom, Australia, Brazil & South Africa with the only Privacy Suite for WordPress that offers a fully-featured plugin for Worldwide Compliance.

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:

Recent articles

The Privacy Suite for WordPress
Get compliant today with the only Privacy Suite made for WordPress


Popular articles

Join our mailing list - 8 Tips & Tricks in your inbox over the next 8 weeks!