Salesforce

Downloading and Deploying Scripts from Local Hosting

« Go Back
Information
Downloading and Deploying Scripts from Local Hosting
UUID-3e2923d6-8364-c2fa-0625-7897395f4cd2
Article Content

Using Cookie Consent, 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.

  1. On the Cookie Consent menu, select Scripts. The Scripts list screen appears.

  2. Click the name of a script you want to run locally. The script details appear.

  3. 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.

  4. Go to the Production Scripts tab.

  5. Click the Download button. A confirmation modal appears.

    DownloadToLocal.png
  6. When your script download is ready, click the Notifications icon Notification_ICon.PNG. The Notifications popover appears.

  7. Click the Download button on the ScriptDownload file. The script downloads to your device.

    script_download.png
 

To implement the downloaded script files

  1. Extract the files in the .zip file.

  2. Copy the extracted folder into your root directory or wherever is most appropriate on your server.

  3. Copy the script from your OneTrust account and paste it into the <head> section of your website.

  4. 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.

  5. 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 -->
  6. 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.

 
 
 
Article Visibility
9,082
Translation
English
Checked

Powered by