Installing Osano on Woocommerce

  • Updated

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

Woocommerce

In order to run effectively, however, Osano needs to be injected into the global <head> of the document. 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>.

For compliance reasons, the Osano script should be the first script to execute in the <head> of your website. 

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. 

[Example plugin: Insert Headers and Footers

  1. In this example, all you need to do is add your Osano.js into the "Scripts in Header" section complete with <script> tags. 
       <script src="https://cmp.osano.com/user_id/config_id/osano.js"></script>

    User_id / Customer_id

    This is generated by the Osano application when you create your osano.js. It is the first string of numbers in your javascript and will be unique to your organization. All configurations in your account will have the same user/customer_id.

    Configuration_id

    This is generated by the Osano application when you create your osano.js. It is the second string of numbers in your javascript and will be unique to each configuration you create. All configurations in your account will have a unique configuration_id. 

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

Once added and saved, run the application, inspect and check. You should see the script added inside the head tag. 

Important: The Osano.js should be placed without any async or defer attributes. Compliance cannot be guaranteed when using the attributes above.