Skip to content

Frameworks

Marketplace

Platform

Resources

↑↓ to moveEnter to openHelp, news and every page are found here too

Adding Asiri Consent to WordPress

Install the Asiri Consent plugin, paste your source id and publishable key, and optionally record answers from your forms.

Updated

The Asiri Consent plugin puts your Asiri banner on every page of a WordPress site and tells the WP Consent API what each visitor chose, so other plugins that listen to it wait for a yes before they run.

Who can do this

An Owner or Admin of your Asiri workspace. The secret key, where a step needs one, is visible to Owners and Admins only.

Before you start

You need a source in Asiri and a publishable key. Open Consent, then Sources, choose your source and open its Install tab. Your source id is on that page. A publishable key starts with pk_live_ or pk_test_; make one on Consent's Keys page, opened by Keys beside the source on Sources, if you have not got one. A publishable key goes in the page and records choices against a visitor only. A secret key starts with sk_ and never goes in a page, a theme or a tag.

Install it

  1. In WordPress, open Plugins, then Add New, and search for Asiri Consent once it is listed in the plugin directory. Install and activate it. The WP Consent API plugin is installed with it.
  2. Open Settings, then Asiri Consent.
  3. Paste your source id and your publishable key, and save.
  4. Open your site in a private window. The banner should show. The settings page shows Not registered in red if the plugin is not registered with the WP Consent API.

What it does

  • Loads the banner script from a pinned version with a Subresource Integrity hash. The plugin never fetches or installs code.
  • Sets Google Consent Mode defaults before any Google tag.
  • Adds a block, Asiri: cookie settings link, and the shortcode [asiri_preferences]. Either prints a button that opens the visitor's choices.
  • Sets no cookies of its own, and has no "accept on scroll" or "implied consent" setting.

Recording answers from forms (optional)

The plugin can add consent boxes to WPForms, Gravity Forms, Contact Form 7 and WooCommerce checkout. Every box starts unticked, and an unticked box is recorded as a no. To switch it on, add your secret key to wp-config.php as ASIRI_SECRET_KEY. It is never saved in the database or shown on any page.

If something is wrong

  • No banner: check the source id and the publishable key are the pair shown on the Install tab, and that a page cache has been cleared.
  • The wrong consent type for visitors in California: your page cache may be ignoring the country and region headers. The browser script corrects it once it knows the visitor's region.
  • Plugins that ignore the choice: without a consent manager registered, the WP Consent API says yes to every category.

Can’t find what you need? Contact us.