Search
Close this search box.

Add a link to show the Cookie Banner (“Manage Consent” button)

You may want to insert a link or button that opens the Cookie Banner to allow your visitor to change their preferences. The available Complianz shortcodes have been listed in an earlier article, Used shortcodes by Complianz, but you might have noticed that there is no shortcode that shows the Cookie Banner without revoking consent.

Luckily, this can easily be fixed with some customization.

Adding javascript to trigger the Cookie Banner

By adding the filter below, the banner can be triggered with a single click and without altering your users’ consent choices.

This script can either be added as a recommended MU Plugin or to functions.php, most preferably in your child’s theme. This will also work in a plugin like Header Footer Code Manager, but in this case you can only use the code between the script tags. Don’t forget the script tags as well.

Creating a link that opens the Cookie Banner

Adding a custom CSS class to your link will trigger the filter that you added in the previous step. An example is shown below:

You can also add the class to a button if so preferred. This is how you can style your new link:

Here’s an example!

Manage your cookie preferences by clicking here.

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.