Geo-target Cookie Message Bar for Countries Other Than EU Using GDPR Cookie Consent Plugin

Using the GDPR Cookie Consent plugin by WebToffee, you can make the cookie bar appear only to the visitors of EU countries. But if you need to display the cookies bar to countries other than the EU, the following code snippet allows you to do just that.

For that, first, enable the geo IP feature from the Cookie Law Settings page under GDPR as shown in the screenshot below:

Enable geo IP
Enable geo IP

After you have enabled the geo IP feature in the Settings page, add the below code snippet with the corresponding¬†country code in the array_push() function. The code snippet below allows you to display the cookie message bar in Canada. Simply, copy the code snippet to the active child theme’s function.php file to achieve this.

Leave a Reply

Your email address will not be published. Required fields are marked *