Unlike the policy embed codes, the cookie consent solution embed code must be pasted into the the header section of your website and before any other 3rd party scripts that you may be using (such as Google Analytics or Facebook Pixel).
No matter what route you go, it is essential that you ensure the consent solution gets pasted as high up in the <head> as possible. This ensures the consent tool can control all scripts on the website and collect consent prior to those scripts firing and placing cookies on the user's browsers.
Here are three options to insert this code into your WordPress website:
1. Use the Termageddon plugin (RECOMMENDED)
Termageddon has a plugin that helps make the cookie consent installation process a breeze. The plugin also helps resolve a conflict with the DIVI theme (upon activation, go to 'settings' within the Termageddon plugin and 'deactivate' the consent tool for logged in administrators. This will fix the issue with the Visual Builder not showing.). The consent tool also has a geolocation feature, meaning you can select who you'd like to display the consent tool (so for example, only to people in the EU, UK and Canada, for example).
Steps:
1. Download and activate the Termageddon Usercentrics Plugin in your WordPress backend
2. Click 'Tools' -> "Termageddon + Usercentrics"
3. On the first page, paste the Usercentrics cookie consent solution embed code and click save.
4. That's it. Be sure to test the website to confirm everything is working (and submit test form submissions through any contact form(s) if you're using security features like reCaptcha).
If you pasted this cookie consent embed code somewhere else in the backend of your website prior to using the plugin, you will need to remove it now that it's pasted within the plugin.
2. Using a WordPress theme? Check for an area to insert code into the <head> section via the theme settings
Many WordPress themes offer the ability to insert scripts into the header section of the website. But because all themes are different, you will need to find out how to do this specifically for your theme. This can usually be done by doing a Google search for something like "insert script into header using [theme-name] theme".
After you identify how to insert scripts into your <head> section, make sure to copy and paste the "Cookie consent solution" embed code from your Termageddon dashboard into that area of your website editor. Also, make sure this Cookie Consent Script is pasted above all other tracking scripts you insert into your website.
2. Use Code Snippets
If you use code snippets, you can add the following code to insert your cookie consent code:
add_action( 'wp_head', function () { ?>
<!-- header code goes here -->
<?php } );
3. Advanced route - Using a Child Theme (for developers)
For developers, the easiest way to insert the embed is to simply add it immediately after the <head> opening tag within the child theme. If you don't know what a child theme is, then you should consider options 1 or 2 above instead.