Using , you can download your script and run it on your local server.
Production CDN
When using the Production CDN, a small portion of the script is placed in the <head>
section of a website. This script then calls the remainder of the script from OneTrust servers and it is displayed to the website visitor. Hosted scripts are also automatically updated whenever a new version of the script is published.
Download to Local
The structure of the script is identical to the scripts hosted on the Production CDN, but the script placed in the <head>
section of the website will need to be pointed to the locally hosted files.
Important
Download and redeploy the downloaded script whenever a new version of the script is published for the changes to take effect.
To download the script to run locally
You can download all the files to run the script on a local server, bypassing the need for the OneTrust CDN. Make sure you republish your script for any recent changes to be reflected in the downloaded script files.
-
On the menu, select . The Scripts list screen appears.
-
Click the name of a script you want to run locally. The script details appear.
-
Clicking the Publish Production button to publish the script. For more information, see Implementing Cookie Consent Scripts.
Note
Download to Local is not available for Test Scripts.
-
Go to the Production Scripts tab.
-
Click the Download button. A confirmation modal appears.
-
When your script download is ready, click the Notifications icon . The Notifications popover appears.
-
Click the Download button on the ScriptDownload
file. The script downloads to your device.
To implement the downloaded script files
-
Extract the files in the .zip
file.
-
Copy the extracted folder into your root directory or wherever is most appropriate on your server.
-
Copy the script from your OneTrust account and paste it into the <head>
section of your website.
-
Replace the CDN URL with the location and filenames of the files you have copied to your server.
<!-- OneTrust Cookies Consent Notice start for onetrust.com -->
<script type="text/javascript" src="Path/To/OtAutoBlock.js" ></script>
<script src="Path/To/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="613ddaca-ed41-4f59-8b82-35a077b37879" ></script>
<script type="text/javascript">
function OptanonWrapper() { }
</script>
<!-- OneTrust Cookies Consent Notice end for onetrust.com -->
Note
You will need to download and extract the files every time you publish your script for any changes to take effect.
-
Paste the following into your website to display a Cookies Settings button. The main script tag must also be present on the website.
<!-- OneTrust Cookies Settings button start -->
<button id="ot-sdk-btn" class="ot-sdk-show-settings">Cookie Settings</button>
<!-- OneTrust Cookies Settings button end -->
-
Paste the following to display a detailed Cookie Policy button. The main script tag must also be present on the website.
<!-- OneTrust Cookies List start -->
<div id="ot-sdk-cookie-policy"></div>
<!-- OneTrust Cookies List end -->
Use Case: Download to Local for Websites in China
The OneTrust Cookie Consent service is designed to be Software-as-a-Service (SaaS) product. However, OneTrust's Content Distribution Network (CDN) has difficulty crossing the Chinese firewall. This leads to problems with the banner script failing to load or massive degradation of script performance.
It is recommended that customers seeking to utilize Cookie Consent on websites hosted in China do so by using the Download to Local option and host the script inside of the Chinese firewall.