Installing Osano on Wordpress

  • Updated

Installing the Osano.js

After creating and publishing your configuration, the "Get Code" button will become active. This button will provide you with the osano.js.

Osano Install Button

To install, copy, and paste the osano.js into the page head [<head>] for all sites you wish to monitor. Ensure that the osano.js is the first script that loads on your site. 

Osano.js install example

Osano is platform-agnostic, which means the code can be added to the <head> of any site and utilized without any additional configuration. 

Once the osano.js is in your site's <head>, it can take a few minutes to a few hours before the script has captured and reported cookies and scripts that exist across your sites. 

Once you have collected enough reports from osano.js, you can work with your other business units to identify and classify all cookies/scripts/and local storage items. This exercise ensures that no "strictly necessary" scripts, cookies, or local storage get blocked.

We recommend users remain in "Listener" mode until you have added the osano.js into your site and have discovered and classified all relevant scripts and cookies. 

Osano CMP Discovery and Listener Modes

 

In Listener mode, the consent manager will NOT block any scripts or beacons. It will NOT delete cookies. It will NOT display dialogs to your visitors. In other words, it will not alter your site in any way. You can use Osano in "Listener" mode and another CMP simultaneously if you migrate away from another provider. This way, there are no gaps in compliance.

After you have categorized each script and cookie appropriately, you can enable Permissive or Strict Mode and publish these changes. 

You will now see the consent dialog on your website!

Wordpress

Note: This is ONE way of adding the Osano code onto your Wordpress site. Other methods can be used. Ex. Editing your theme's functions.php file 

To add the Osano script to your WordPress site, you can utilize a plugin to add custom javascript code to your site <head>.

Using Plugins: 

Using a plugin is the recommended method when you don't want to edit the source files directly or when you want to add theme-independent JavaScript. 

Many plugins can add custom JavaScript to WordPress, but the most basic and straightforward for this implementation is to use a plugin for editing the header and footer templates. To add scripts that load before the page content, such as Osano, you need to edit the header template. 

[Example plugin: Insert Headers and Footers

In this example, all you need to do is add your Osano.js into the "Scripts in Header" section complete with <script> tags. 

Ex. <script src="https://cmp.osano.com/9o8yutfgvjkksnhkj/9374737-354-6435-3454-5454/osano.js"></script>

Save and deploy this code, and the Osano code will be added to your Wordpress site. 

Note: If you want to make any <style> changes to your Osano CMP, you can add them here as well. 

Ex. <script src="https://cmp.osano.com/9o8yutfgvjkksnhkj/9374737-354-6435-3454-5454/osano.js"></script> 

 

IMPORTANT NOTE: If you are using Rocket Loader or WP Rocket, it is important to ensure it does not defer or minify the Osano.js.  This will result in caching and can have unintended side effects when publishing new versions of the Osano code.