Implementing Mobile Scripts for iOS and Android
The script tags are the snippets of code you can use to implement the banner and preference center on your site. Once the tag is implemented on your site, any changes to your template, rules, or categorizations will be published on your site and the script does not have to be re-implemented.
Testing and Production CDNs
The Testing CDN or Production CDN script should be implemented first in the <head> section of your site pages. It contains a unique identifier that is specific to the domain for which it was generated.
The script needs to be loaded on each page of your domain in order to ensure site visitors are immediately presented with a banner and preference center when visiting your site. If you use a site builder or content management system (CMS) to manage your domains, you may be able to customize this in your site template or through a code injector feature.
The script must be placed before any other script in your site in order to ensure the banner is loaded before any other scripts load or set cookies. This allows the script tag to communicate the site visitor's consent preferences to downstream vendors.
The Testing CDN matches the Production CDN script except:
-
There is no cache, meaning changes can be viewed immediately.
-
This script will function on your test site and should be used for testing purposes.
Note:When a cookie is writen, it is written to a specific domain, such as
.example.comorwww.staging-example.com. A cookie written in.example.comis sent in any requests for the root domain. However, if you were on a different domain, such aswww.staging-example.com, you would not be able to write a cookie on.example.com. The Testing CDN script writes cookies to the domain it is currently on, allowing it to behave like the Production CDN script in a testing environment.
The Production CDN script references an SDK hosted by OneTrust. If you want to host the SDK on your own servers, you can download the full SDK and host it locally.
To Implement the Testing CDN Script
Testing CDN Screen Reference
- Field
- Description
- Testing CDN
-
Shows the text of the script and the Copy Scripts button.
- Publish individual languages.
-
Enable this setting to publish the script for a specific language or languages. If not enabled, all languages will be published.
Note:If language detection is not enabled for the script, you will have to publish the languages individually.
- Do you require users to re-consent?
-
Enable this setting if your consent framework requires site visitors to re-consent.
- Enable Autoblocking
-
Enable this setting to use cookie autoblocking based on cookie category.
- Enable Language Detection on Scripts
-
Enable this setting to allow the script to detect the site visitor's language. If the language cannot be determined, the default language from the Template will be used.
To implement the Production CDN Script
Use in most live websites. Fastest page load speed. Published changes will take up to 4 hours to show.
Cookie Settings Button
This will display either Do Not Sell My Data button or Cookie Settings button based on the Geolocation Rule Group assigned to the domain and the site visitor's location. The Production CDN script must also be included on the page.
-
On the Cookie Consent menu, select Scripts. The Scripts screen appears.
-
Click on the name of the domain you want to implement. The Scripts Details screen appears.
-
Click the Publish. The Publish pane appears.
-
Click Next to navigate to the Production tab.
-
Click the Copy Script button for the Cookie Settings Button script.
-
Paste the copied script in the code for your site. The Cookie Settings Button references the script that is placed in the
<head>of the site.
Cookie List
This code will insert a detailed Cookie List including description and table of cookies based on the current cookie assignment. You can embed the script in a privacy policy or a standalone cookie list page. The Production CDN script must also be included on the page.
-
On the Cookie Consent menu, select Scripts. The Scripts screen appears.
-
Click on the name of the domain you want to implement. The Scripts Details screen appears.
-
Click the Publish. The Publish pane appears.
-
Click Next to navigate to the Production tab.
-
Click the Copy Script button for the Cookie List script.
-
Paste the copied script in the code for the page where you want to display the list. The Cookie List references the script that is placed in the
<head>of the site.
Production CDN Screen Reference
- Field
- Description
- Publish Individual Languages
-
Enable this setting to publish the script for a specific language or languages. If not enabled, all languages will be published.
- Do you require users to re-consent?
-
Enable this setting if your consent framework requires site visitor's to re-consent.
- Enable Autoblocking
-
Enable this setting to enable cookie autoblocking based on cookie category.
- Production CDN
-
Shows the text of the script and the Copy Scripts button. Click Download to download the SDK to host locally.
- Do Not Sell & Cookie Setting Button
-
Shows the text of the script and the Copy Scripts button. The text displayed will depend on the Geolocation Rule Group and the location of the site visitor.
- Cookie List
-
Shows the text of the script and the Copy Scripts button.