Integrate OneTrust with Instapage to display a cookie consent banner and manage cookie compliance on your landing pages. Before beginning the integration process, make sure you have access to your OneTrust account, your Instapage workspace, and the landing page URL you want to configure.
Configure Your Website in OneTrust
After logging into OneTrust, navigate to Cookie Compliance from the My Apps section on the homepage. From the dashboard sidebar, open Websites and click Add Website in the top-right corner.
Enter your landing page URL, select your organization, and click Scan & Configure.
If this is your first setup, select Create Custom Experience Kit. If you already have a saved experience, you can reuse it instead. Enter a name for your experience, choose the compliance framework you want to use, and continue through the setup wizard.
You will then be prompted to configure your cookie banner and preference center layouts. Select the layouts you prefer and upload your logo within the Branding sections where applicable. Once your configuration has been reviewed, click Confirm to finalize the setup.
Categorize Cookies
Once the website scan has completed, navigate to Cookiepedia > Categorizations. Here, you will see a list of cookies detected on your website.
Some cookies may appear with an Unknown category and must be categorized manually before the integration can function correctly.
Select the cookies you want to categorize, click Recategorize, and assign the appropriate category, such as Functional Cookies or Analytics Cookies.
After categorizing your cookies, navigate to Categories and locate the category you assigned. You will need to copy the category ID associated with that category.
Example:
Functional Cookies = C0003This ID will be used later inside the Instapage consent management script.
Publish the OneTrust Script
To publish the cookie banner script, navigate to Integrations > Scripts within OneTrust. Select the page or domain you want to integrate, open Production Scripts, and publish the production version of the script.
From the Production Scripts page, copy the first <script> tag provided by OneTrust.
The script will look similar to the example below:
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"
type="text/javascript"
charset="UTF-8"
data-domain-script="328693cc-7d8d-426b-8cef-fb6c267d70c4">
</script>Add the Scripts to Instapage
Inside Instapage, open your landing page and navigate to Scripts & Privacy.
Paste the OneTrust production script into the Head section.
After that, add the following Instapage consent management script into the same Scripts & Privacy section:
<script>
function OptanonWrapper() {
instapageConsentManagement()
}
function instapageConsentManagement() {
// Add your analytics group ID below
var analyticsGroupId = null
// Terms used to identify analytics categories
var searchTerms = ['analytics', 'analysis', 'traffic']
if (isAnalyticsAccepted(analyticsGroupId)) {
window._instapageConsentManagement('enableAll');
} else {
window._instapageConsentManagement('disableAll');
}
function isAnalyticsAccepted(analyticsGroupId = "") {
// If no analyticsGroupId is provided,
// the script will attempt to find it automatically
if (!analyticsGroupId) {
analyticsGroupId = findAnalyticsGroupId()
}
return OnetrustActiveGroups
.split(",")
.filter(Boolean)
.indexOf(analyticsGroupId) != -1
}
function findAnalyticsGroupId() {
var regex = new RegExp(searchTerms.join('|'), 'i')
var group = Optanon.GetDomainData().Groups.filter(group => (
regex.test(group.GroupName) ||
regex.test(group.GroupDescription)
))[0] || {}
return ('CustomGroupId' in group)
? group.CustomGroupId
: ''
}
}
</script>Within the script above, locate the following line:
var analyticsGroupId = nullReplace null with your cookie category ID and ensure the ID remains inside double quotes.
Example:
var analyticsGroupId = "C0003"Once the scripts have been added and updated, save your changes in Instapage and republish your landing page.
Your Instapage landing page is now integrated with OneTrust and configured for cookie consent management.
Recommended Configuration
We recommend keeping the OneTrust Auto-Blocking feature disabled.
Auto-blocking can interfere with GA4 cookies and other tracking scripts, potentially preventing cookies from being set correctly even after consent has been granted.