What This Article Covers
If your website already uses a consent management tool like Cookiebot, OneTrust, or Termly to handle cookie consent banners, you can connect it with TripWorks. This ensures that when a visitor accepts or declines cookies on your site, TripWorks respects those choices automatically.
Before You Begin
You'll need:
- Access to your TripWorks account
- Access to your website's code (or your web developer)
- An existing CMP already set up on your website
Step 1: Request “Operator Manages Consent” from TripWorks
First, let TripWorks know that you'll be handling consent through your own tool.
Contact your TripWorks account manager or reach out to support and ask them to enable "Operator Manages Consent" for your account.
Once enabled, TripWorks will no longer display its own cookie consent banner on your booking pages.
Step 2: Add the Integration Code to Your Website
Next, add a small script to your website that sends consent information from your CMP to TripWorks.
Choose the code snippet below that matches your consent tool:
If You Use Cookiebot
Add this script to your website after both Cookiebot and the TripWorks widget have loaded:
<script> function updateTripWorksConsent() { window.TripWorks.updateConsents({ ad_storage: Cookiebot.consent.marketing, analytics_storage: Cookiebot.consent.statistics, personalization_storage: Cookiebot.consent.preferences, functionality_storage: Cookiebot.consent.necessary }); } window.addEventListener('CookiebotOnLoad', updateTripWorksConsent); window.addEventListener('CookiebotOnAccept', updateTripWorksConsent); window.addEventListener('CookiebotOnDecline', updateTripWorksConsent); </script>If You Use OneTrust
Add this script to your website after both OneTrust and the TripWorks widget have loaded:
<script> function updateTripWorksConsent() { const activeGroups = window.OnetrustActiveGroups || ''; window.TripWorks.updateConsents({ ad_storage: activeGroups.includes('C0004'), analytics_storage: activeGroups.includes('C0002'), personalization_storage: activeGroups.includes('C0003'), functionality_storage: true }); } function OptanonWrapper() { updateTripWorksConsent(); } window.addEventListener('OneTrustGroupsUpdated', updateTripWorksConsent); </script>Note: The group IDs (C0002, C0003, C0004) are OneTrust defaults. If you've customized your OneTrust setup, you may need to adjust these to match your configuration.
If You Use Termly
Add this script to your website after both Termly and the TripWorks widget have loaded:
<script> function updateTripWorksConsent() { const consent = window.termly ? window.termly.getConsentState() : null; if (consent) { window.TripWorks.updateConsents({ ad_storage: consent.advertising === true, analytics_storage: consent.analytics === true, personalization_storage: consent.personalization === true, functionality_storage: true }); } } document.addEventListener('termlyConsentUpdated', updateTripWorksConsent); window.addEventListener('load', function() { setTimeout(updateTripWorksConsent, 1000); }); </script>If You Use a Different CMP
Use this template and adapt it to your specific consent tool:
<script> function updateTripWorksConsent() { window.TripWorks.updateConsents({ ad_storage: /* your CMP's marketing consent value */, analytics_storage: /* your CMP's analytics consent value */, personalization_storage: /* your CMP's preferences consent value */, functionality_storage: true }); } // Call this function whenever consent changes in your CMP </script>Step 3: Test Your Integration
After adding the code, verify everything is working:
- Clear your browser cookies and refresh your website
- Check that only your CMP's banner appears (not TripWorks')
- Accept cookies and open your browser's developer console (F12 or right-click > Inspect > Console)
- Look for this message:
[TripWorks API] updateConsents called: - Test declining cookies — marketing pixels should be blocked
Understanding Consent Categories
TripWorks uses four consent categories that align with privacy regulations:
| Category | What It Controls |
|---|---|
| Ad Storage | Marketing pixels like Facebook, TikTok, and Google Ads |
| Analytics Storage | Tracking tools like Google Analytics |
| Personalization Storage | Features like saved preferences and language settings |
| Functionality Storage | Essential cookies needed for the site to work properly |
Your CMP likely uses similar categories — the integration code maps them to TripWorks' categories.
Troubleshooting
Both banners are showing (yours and TripWorks')
- Double-check that "Operator Manages Consent" is enabled in TripWorks settings (ask support or your account manager to verify)
- Clear your browser cache and cookies, then reload
Marketing pixels are loading before consent is given
- Make sure your CMP script loads before the TripWorks widget in your page's code
- Verify your CMP is set to block scripts until consent is granted
Console shows "operator_manages_consent is false"
- Ask support or your account manager to ensure "Operator Manages Consent" is enabled on your account
Consent changes aren't being recognized
- Ensure your integration script listens for all consent events (initial load, accept, decline, and updates)
Need Help?
If you're having trouble with your integration, contact TripWorks support (support@tripworks.com) with:
- Your account name
- Which CMP you're using
- Screenshots of any error messages in your browser console
- A link to your website where the widget is embedded