Migrating from OneTrust to CookieScript
ON THIS PAGE
- Can You Transfer OneTrust Settings and Consent Preferences to CookieScript?
- Step 1: Audit and Document Your OneTrust Setup
- Step 2: Preserve Records and Map the New Configuration
- Step 3: Configure CookieScript in Staging
- Step 4: Rebuild Script Blocking, GTM, and Google Consent Mode
- Step 5: Test the Migration Before Launch
- Step 6: Remove OneTrust and Complete the Production Cutover
- Common OneTrust-to-CookieScript Migration Problems
- Conclusion
Migrating from OneTrust to CookieScript involves more than replacing your Cookie Banner. You need to preserve your existing consent records, recreate your cookie categories and blocking rules, update Google Tag Manager (GTM) and Google Consent Mode where applicable, and remove OneTrust without disrupting tracking. The safest approach is to prepare and test CookieScript before switching production.
Follow these six steps:
- Audit your OneTrust setup. Identify where OneTrust is installed, how it blocks scripts, and which GTM triggers, consent events, regional rules and custom functions depend on it.
- Preserve records and map categories. Save your historical consent data and configuration, then review how your existing cookie categories and technologies should be classified in CookieScript.
- Configure CookieScript in staging. Set up your banner, categories, languages and regional settings in a test environment, and plan consent recording for production.
- Rebuild consent controls. Replace OneTrust's script-blocking logic and, where applicable, its GTM dependencies, custom consent events and Google Consent Mode configuration with the appropriate CookieScript mechanisms.
- Test the complete consent lifecycle. Verify acceptance, rejection, category preferences, consent changes, script execution and tracking behaviour across relevant pages and regions.
- Complete the production cutover. Remove OneTrust scripts and obsolete integrations, activate CookieScript, update your Cookie Settings links and verify that everything works correctly.
Before you begin, arrange access to your OneTrust configuration and consent exports, the CookieScript account, your website deployment and GTM container (if used). Prepare a separate test site where OneTrust can be disabled without changing production, and check that your CookieScript plan includes any features you need, such as automatic blocking, Consent Recording or IAB TCF 2.4.
A saved OneTrust choice is not automatically a CookieScript preference, and historical OneTrust consent records remain separate from those generated after launch.
Avoid running OneTrust and CookieScript as independent consent management platforms (CMPs) controlling the same production tags, as this can create conflicting blocking rules and consent signals.
Can You Transfer OneTrust Settings and Consent Preferences to CookieScript?
There is no documented automatic transfer of OneTrust settings to CookieScript. OneTrust values such as data-domain-script, category IDs and GTM conditions can guide your audit, but you must recreate the relevant configuration in CookieScript.
Existing visitor choices are a separate issue. OneTrust stores them through OptanonConsent and category/group state, while CookieScript maintains its own consent state. There is no documented automatic conversion path between them. The fact that a OneTrust cookie remains in the browser does not make it an active CookieScript preference.
Plan the first CookieScript visit for both new and returning visitors. If CookieScript has no saved choice for a visitor, present the appropriate banner and keep technologies requiring prior consent blocked until a valid choice is available.
Do not interpret an unrecognised OneTrust preference as acceptance or automatically invoke CookieScript's programmatic acceptance functions to copy it. Check the Keep cookies until consent setting separately: it changes how existing cookies are retained before a choice, not whether the visitor has consented or whether scripts are blocked.
Whether an earlier consent remains valid is a separate compliance question. The UK Information Commissioner's Office requires fresh consent when new storage or access technologies introduce a purpose not covered by the original choice.
Review changes to purposes, vendors, disclosures and applicable rules before deciding whether to request consent again. Without a verified transfer mechanism, do not assume that previously recorded OneTrust choices can be applied through CookieScript.
Step 1: Audit and Document Your OneTrust Setup
Audit both the installation points and the code that relies on OneTrust. You will need this inventory when rebuilding consent controls in Step 4.
Find Every OneTrust Installation Point
OneTrust’s publishing documentation distinguishes testing and production domain scripts. Check these installation points:
- HTML source, rendered pages and the global website header
- Themes, page templates and CMS script-injection settings
- GTM containers and other tag-management configurations
- Regional and language-specific pages
- Other domains, subdomains and cached page versions
- Locally hosted OneTrust scripts
Search your codebase, HTML and GTM for otSDKStub.js, OtAutoBlock.js, data-domain-script, OptanonWrapper, OnetrustActiveGroups and OptanonConsent. Check preference links for ot-sdk-show-settings and cookie lists for ot-sdk-cookie-policy.
This is a documented OneTrust CDN pattern; XXXXXX is a placeholder. Auto-Blocking installations may also load OtAutoBlock.js (OneTrust installation example):
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="XXXXXX"></script> <script type="text/javascript"> function OptanonWrapper() { } </script> Record Blocking, GTM, Regional and Custom Dependencies
Your site may use OneTrust Auto-Blocking, GTM controls or JavaScript type-rewriting. Identify which governs each technology. If OtAutoBlock.js is active, record source-URL classifications, exceptions and GTM rules.
You may find OneTrust type-rewritten scripts like this. Verify the category ID in your tenant:
<script type="text/plain" class="optanon-category-C0002"> // Existing consent-dependent code </script> OneTrust’s client-side documentation describes consent-dependent helper methods such as OneTrust.InsertScript. Inspect every function OptanonWrapper() for these methods, SDK calls and category checks, and record what they control before replacing them.
In GTM, review your tags, variables, triggers, lookup tables and custom JavaScript for:
- References to
OnetrustActiveGroupsorOptanonConsent - Your OneTrust category IDs and related conditions
- Listeners for
OneTrustGroupsUpdatedor other consent events - Code that needs a saved consent state or a new visitor action
- IAB TCF configurations, vendor selections and TC String dependencies, if enabled
- Global Privacy Control (GPC), regional opt-out configurations and any Global Privacy Platform (GPP) integrations
OneTrust’s GTM guide documents OneTrustGroupsUpdated on page load and after preference updates, while its client-side documentation confirms that OTConsentApplied follows an explicit action. Use those differences to choose new triggers for saved consent versus fresh user actions.
Record any OneTrust geolocation rules that change templates or consent models by region. OneTrust also supports GPC rules and documents GPP signalling. The default banner may not show you what visitors in other locations see.
Step 2: Preserve Records and Map the New Configuration
Keep evidence of previous consent decisions, but rebuild CookieScript’s categories around the technologies your site uses. Preserving records and mapping categories are separate tasks.
Export the OneTrust Information You Need
Before disabling OneTrust, save the records you need for audits and rollback. You can export Cookie Consent dashboard data for reporting, but those reports are not individual consent receipts.
If your account has the feature and permissions, use Cookie Consent → Bulk Export to export CMP receipts. OneTrust limits this feature to customers with solution packaging and applies export-credit limits; confirm access before removing the old deployment.
You can also export website and scan data. Keep copies of:
- Category definitions, assignments and blocking exceptions
- Custom JavaScript and consent-dependent helper methods
- Banner screenshots, preference text and translations
- Geolocation rules, covered domains and regional consent models
- GTM container versions, events and Consent Mode settings
Use screenshots or configuration notes for settings you cannot export.
Map OneTrust Categories to CookieScript by Purpose
Review OneTrust’s Strictly Necessary, Functional, Performance, Targeting and Social Media categories, plus any custom categories. Investigate cookies flagged Unknown during scanning; that is not a final consent category.
CookieScript has five underlying cookie categories. You can rename the four non-essential category labels, but not Strictly Necessary:
- Strictly Necessary (
strict) - Functionality (
functionality) - Performance (
performance) - Marketing (
targeting) - Unclassified (
unclassified)
Classify each technology according to its purpose and consent behaviour. Review OneTrust Social Media technologies individually.
Map OneTrust Dependencies to CookieScript
The following is a migration checklist, not a one-to-one conversion table. Category purposes, event timing and existing custom code must still be reviewed for your website.
| OneTrust setup | CookieScript migration action |
|---|---|
otSDKStub.js, data-domain-script, OtAutoBlock.js | Remove the old installation at cutover and use the selected CookieScript installation and blocking method. |
optanon-category-... scripts | Reclassify each technology and replace old markup with CookieScript's manual blocking attributes, where needed. |
OnetrustActiveGroups and GTM conditions | Rebuild relevant conditions using CookieScript Consent State or the appropriate GTM consent controls. |
OneTrustGroupsUpdated and custom event listeners | Choose CookieScript category or action events based on whether code needs an accepted category or a new interaction. |
OptanonConsent and old consent receipts | Keep exported historical records separately; allow CookieScript to establish and record its own choices. |
| OneTrust regional, TCF and GPC settings | Rebuild the applicable configuration and validate its signals separately; do not assume identical defaults or framework support. |
Review IAB TCF 2.4, GPC and Other Privacy Signals
If your OneTrust installation uses the IAB Transparency and Consent Framework (TCF), carry out a separate advertising-consent review. As of October 2026, both OneTrust and CookieScript document support for IAB TCF 2.4.
The web implementation deadline was October 23, 2026. This version updates disclosures and consent-scope explanations; it is not a new set of cookie categories or a way to import OneTrust preferences.
CookieScript lists IAB TCF 2.4 under its Plus plan. To configure it, go to Settings → Frameworks and enable IAB TCF 2.4. Review your actual advertising vendors under Select vendors instead of carrying over a general vendor count.
Check the required Show All Partners disclosure, purposes, vendor details and any descriptions of the scope of consent, especially if your OneTrust banner described cross-device or cross-domain choices.
If the existing site uses Global Privacy Control (GPC), compare its OneTrust geolocation and GPC rules with CookieScript's Settings → Frameworks → Global Privacy Control setting.
GPC communicates a browser-level opt-out preference about selling or sharing personal data. Verify how the replacement responds to that signal in each applicable region, including the resulting categories and downstream tags; enabling an option is not a substitute for testing the opt-out.
OneTrust also documents Global Privacy Platform (GPP) signalling. GPP and GPC are different mechanisms. Do not assume CookieScript's GPC setting replaces an existing GPP integration. If your site relies on GPP or another region-specific consent string, confirm the required CookieScript support and downstream behaviour before switching off OneTrust.
Step 3: Configure CookieScript in Staging
Prepare CookieScript on a test copy with OneTrust disabled there, leaving production unchanged. This differs from CookieScript’s named Staging Mode for existing CookieScript sites; its pre-production option applies to not-yet-live websites.
Choose a supported installation method for each CookieScript banner:
- Add the script tag in the website
<head> - Use the CookieScript GTM Community Template
- Install through a supported CMS or platform integration
Install each banner once. Rebuild its wording, categories, languages and preference links without OneTrust code.
Install geo-targeted banners directly in <head>, not GTM. Outside their target region, those banners are hidden and their blocked scripts activate. If you use a separate global banner, follow the geo-targeting instructions and test regional coverage and blocking.
A banner being hidden outside its target region does not establish that every technology is permitted there; review the applicable consent or opt-out requirements for those visitors and check what actually loads.
Run a CookieScript scan and compare the results with your OneTrust inventory, GTM tags and hard-coded scripts. Another active CMP can hide cookies from the scanner, which is why OneTrust must be disabled on the test copy.
Check video embeds, chat widgets and authenticated forms manually, because the scanner cannot complete every interaction or access protected pages.
If your sites use the same cookies or tracking technologies, you can configure cross-domain consent on CookieScript Plus. Test each domain and browser, including Safari and iOS, accounting for sharing restrictions.
If you need consent records, use a plan that supports Consent Recording; CookieScript lists this feature under Plus. Enable it in Main settings, then check and download new records from Consents after launch. CookieScript’s named Staging Mode does not record logs or statistics.
Step 4: Rebuild Script Blocking, GTM, and Google Consent Mode
Use the OneTrust audit to decide how each script or tag should respond to consent in CookieScript. Start with blocking, then replace GTM dependencies and Google Consent Mode settings where applicable.
Give Every Technology One Clear Control Path
Choose one consent-control path per technology: CookieScript automatic blocking, manual blocking or GTM. Automatic blocking is disabled by default and requires Standard or Plus.
- For page scripts, enable automatic blocking under Scripts, assign a category and mark each script for blocking. Load CookieScript first; rescan if needed.
- For hard-coded scripts, you can use the manual blocking attributes such as
type="text/plain",data-cookiescript="accepted"anddata-cookiecategory. - For tags loaded by GTM, you can use consent-related triggers or conditions to control when they fire.
Avoid independently applying automatic blocking to the same tag already controlled by GTM. Rebuild old optanon-category-... markup using CookieScript syntax.
For a script classified as Functionality, CookieScript documents this manual blocking syntax. Set the file path and category based on the technology’s actual purpose:
<script type="text/plain" data-cookiescript="accepted" data-cookiecategory="functionality" src="/js/myscript.js"></script> Review server-set cookies separately: browser blocking cannot prevent cookies set by HTTP response headers. Requests for blocked remote scripts may still occur.
Replace OneTrust GTM Variables and Custom Events
For GTM tags using OnetrustActiveGroups, OptanonConsent or OneTrustGroupsUpdated, distinguish stored consent, an accepted category on page load and a new visitor action.
Use the Consent State variable for GTM conditions, or category GTM events such as CookieScriptCategory-performance when a category becomes available. Saved state alone does not indicate new acceptance.
For code responding to user actions, use events such as CookieScriptAccept, CookieScriptAcceptAll and CookieScriptReject. CookieScriptLoaded means readiness, not consent.
For example, a Performance tag should run when a returning visitor has already accepted that category. A trigger listening only for a new consent click could miss that visit. Conversely, category events can fire again on later page loads; check that they do not repeat actions intended only for a new choice.
These documented events distinguish category availability, accepting selected categories (when categories are enabled) and accepting all categories. Use the listener that matches the behaviour you need:
window.addEventListener('CookieScriptCategory-functionality', function() { // Functionality category is accepted, including on a return visit. }); window.addEventListener('CookieScriptAccept', function(event) { // Selected categories: event.detail.categories lists those accepted. }); window.addEventListener('CookieScriptAcceptAll', function() { // Visitor accepted all categories. }); When migrating code from OptanonWrapper(), distinguish helpers that load scripts from functions that update the page interface. Script-loading helpers need an appropriate consent-control path; interface updates may require a different event listener. Remove unused functions and test each retained dependency after the OneTrust wrapper is gone.
Configure Google Consent Mode Again
If your site uses Google Consent Mode, record its OneTrust integration: mappings, regional rules, tag defaults and Basic or Advanced behaviour.
Enable Google Consent Mode v2 in CookieScript and choose the Google tag behaviour your site requires. Google documents two different implementations:
- Basic Consent Mode: Google tags are blocked until the visitor gives the applicable consent. They do not send Google measurement data before consent.
- Advanced Consent Mode: Google tags may load with consent denied by default and send cookieless measurements before a choice. They adjust their behaviour after the consent state is updated.
Do not use Advanced Consent Mode loading instructions as a universal script order. For a GTM Community Template installation, configure the defaults in CookieScript's template, fire it on Consent Initialization - All Pages, then select Basic or Advanced behaviour for the Google tags. CookieScript recommends the GTM template for this integration. Avoid setting the same consent defaults in a separate GTM Custom HTML tag.
For a direct gtag.js installation, initialise the consent defaults in <head> before gtag.js or any Google measurement command. With Basic Consent Mode, keep Google tags blocked until the relevant consent is granted. With Advanced Consent Mode, the Google tags can load after those defaults have been set.
CookieScript's manual setup guide documents the following default-state snippet; you must still install CookieScript and Google tags according to your chosen mode and blocking controls. Do not add this snippet to an installation already using CookieScript's GTM Community Template:
<script> window.dataLayer = window.dataLayer || []; function gtag() { dataLayer.push(arguments); } gtag('consent', 'default', { ad_storage: 'denied', analytics_storage: 'denied', ad_user_data: 'denied', ad_personalization: 'denied', wait_for_update: 500 }); gtag('set', 'ads_data_redaction', true); gtag('set', 'developer_id.dMmY1Mm', true); </script> Check the Google consent signals relevant to your site:
analytics_storagead_storagead_user_dataad_personalization
In Google Tag Assistant, check that all four consent defaults are set before tags use them and that choices produce the expected updates. For Advanced mode, the presence of cookieless Google requests before consent is expected; for Basic mode, Google tags should remain blocked until consent. Remove obsolete OneTrust-specific consent commands, but retain unrelated Google configuration. Consent Mode does not control every non-Google script.
Step 5: Test the Migration Before Launch
Use a clean browser and developer tools to inspect scripts, network requests, cookies and console errors as you work through these scenarios:
- First visit: Check the regional banner, initial consent state and requests sent before a choice.
- Accept All: Make sure the scripts permitted by that choice can load.
- Reject All: Check that non-essential scripts remain controlled.
- Granular choice: Accept selected categories and verify that unrelated tags stay inactive.
- Change or withdraw consent: Reopen settings after accepting, withdraw one or more categories and inspect subsequent network requests and cookie storage. Check whether integrations that already executed continue collecting data; a changed preference alone does not prove those integrations have stopped.
- Reload and return: Check that your site handles the saved preference across pages and later visits. Test an existing OneTrust visitor with no CookieScript choice separately from one who has already chosen in CookieScript; you can inspect its
CookieScript.instance.currentState()after initialization. - Private browsing: Repeat your first-visit tests without an existing consent state.
- Regional and language variants: Test the domains and configurations your visitors actually use, including whether a hidden geo-targeted banner leaves scripts active.
- TCF and GPC, if applicable: Verify the IAB TCF 2.4 vendor disclosures and resulting signals with the advertising integrations that use them. Test a browser with GPC enabled and disabled against the relevant regional opt-out rules; investigate any remaining GPP dependency separately.
Where you use GTM, open Preview to verify CookieScript triggers and find any leftover OneTrust conditions. If Google Consent Mode is configured, inspect its initial and updated signals using the Consent Mode troubleshooting instructions.
Test login, form submission, checkout, embedded media and chat. Also repeat withdrawal checks after a reload, because some already-initialised third-party technologies need integration-specific handling to stop their activity. These checks catch functionality that a cookie inventory cannot verify.
Step 6: Remove OneTrust and Complete the Production Cutover
Publish the site and GTM changes as one coordinated cutover:
- Confirm that your OneTrust exports and configuration snapshots are safely stored.
- Save the current site build and published GTM version as rollback points.
- Prepare a site build that removes the old OneTrust scripts and Auto-Blocking, installs the tested CookieScript configuration and replaces old preference links.
- Prepare the matching GTM changes, removing obsolete OneTrust conditions and configuring CookieScript consent controls and Consent Mode where applicable.
- Deploy the site and GTM changes together so you do not leave production tags without their intended consent controls.
- Clear relevant CMS, application and CDN caches so visitors receive the new implementation.
- Immediately test the live banner, blocking rules, consent updates and critical tags; if Consent Recording is enabled, also check new CookieScript records. For sites using TCF or GPC, repeat the relevant consent-signal checks after cutover.
Replace old OneTrust links in your footer, privacy pages and mobile navigation. The documented csconsentlink class opens settings:
<button class="csconsentlink">Cookie Settings</button> You can also use the csconsentlink ID or CookieScript.instance.show() where appropriate.
Search live HTML, network requests, GTM, templates, plugins, local files and caches for otSDKStub.js, OtAutoBlock.js, OptanonWrapper and old OneTrust triggers.
Removing OneTrust does not itself erase its cookies. By default, CookieScript deletes existing non-essential cookies before a new choice; Keep cookies until consent changes only their retention, not script blocking or consent signals. CookieScript advises leaving that setting disabled in opt-in regions unless the retained cookies are strictly necessary. Review the classification of OptanonConsent and OptanonAlertBoxClosed, and remove any remaining code that relies on them.
After launch, monitor:
- Your analytics traffic and important conversions
- Advertising requests, duplicate events and Consent Mode signals
- JavaScript errors and Cookie Settings controls
- Regional banner behaviour and user reports
On Standard or Plus, enable automatic monthly cookie scanning to keep your cookie declaration updated as the website changes. Review new scan results and run a manual scan after significant changes instead of waiting for the next scheduled scan.
On Plus, you can enable Cookie Banner Analytics in Main settings to review acceptance, rejection and cookie-category selections. These figures measure consent-banner interactions, not whether analytics or advertising tags work correctly.
If rollback is necessary, restore your previous site and GTM versions together instead of running both CMPs indefinitely.
Common OneTrust-to-CookieScript Migration Problems
- Two banners appear: Look for an old OneTrust injection or a second CookieScript installation in your templates, plugins or GTM.
- Tags fire before consent: Check your script order, blocking rules, GTM triggers and Consent Mode defaults.
- Tags stay blocked after acceptance: Look for overlapping GTM and automatic blocking or a leftover OneTrust category condition.
- Analytics or conversions change unexpectedly: Compare your triggers, mappings and Basic or Advanced Consent Mode behaviour. In Tag Assistant, distinguish blocked Google tags from Advanced-mode cookieless requests.
- Cookie Settings won’t open: Check whether the link still calls OneTrust rather than the CookieScript preference control.
- The wrong regional banner appears: Review your geo-targeting and confirm that geo-targeted code is in the site header.
- Some pages still load OneTrust: Inspect alternate templates, other domains, locally hosted scripts and cached HTML.
- Returning visitors are treated as already opted in: Check whether legacy
OptanonConsentvalues or custom code are incorrectly being used to grant CookieScript categories. - Ad vendors or opt-outs behave differently: Compare your IAB TCF 2.4 vendor selections and GPC tests against the pre-migration inventory, and investigate any required GPP signals separately.
Conclusion
Your migration is complete when CookieScript governs consent, critical tags and site functions pass production checks, no obsolete OneTrust code controls tracking, and historical records remain available.
CookieScript is a Consent Management Platform (CMP) included among Google's CMP partners available for Consent Mode setup. A 14-day free trial of the Plus plan is available without requiring a credit card.
Compare CMP prices and features side by side
Pick up to 4 consent platforms, set your number of websites and see yearly prices, pageview limits and features in one view.
- Yearly prices for 1 to 200 domains
- Pageview limits and extra fees
- Features and customer reviews