Debugging OneTrust: Lesser-Known Tips & Tricks
By now you’ve probably implemented Cooke Consent or Advertising Consent modal and preference center on your website. With just over 40% market share the odds are good you went with OneTrust. So you’ve gotten your first Cookie Scans done, put all of them in categories and deployed your preference center and banner code. That’s when you can run into some challenges validating your implementation. Here are a couple of tips to let you figure out if things are behaving properly, or not.
The first problem a lot of sites have is how to QA on OneTrust Cookie Consent for countries they aren’t in. You could use a VPN, but maybe your company doesn’t have VNP enabled locations in every country you want to test. You can use a free or paid VPN, but they can be slow or cumbersome. There are geolocation masking tools for most browsers, but they don’t always fool the page you’re testing.
Luckily OneTrust introduced a feature last year that allows you to set your location manually. By including the “?otgeo=” query string parameter on any site page you can override the geolocation mechanism in OneTrust with any ISO-3166 two letter country code.
If you’ve taken on the challenge of treating each notable US state differently amid their patchwork of very similar but distinct rules you can even pass in a state code using the US,<state_code> syntax. So for New Jersey that’d be ?otgeo=us,nj. Don’t worry if it looks a little weird in the address bar, that’s just the browser URI encoding the comma.
All right, that override sounds useful, but how can I be sure it’s working? The answer is the OneTrust debug object. With OneTrust Cookie Consent running on the site there will be a OneTrust js object in window scope. By invoking the testLog() method of the OnesTrust object in the console you’ll get a neat stack of useful debugging information about your current consent state and other settings.
Under Geolocation and Template it’ll show you which Geolocation region you’ve bene sorted into and which rule and template have been triggered.
If you need even more specifics on your geolocation as OneTrust sees it you can access the OneTrust.geolocationResponse property which contains the country and state code, or the Province / Territory code for Canada.
Additionally Under “Current Category Status” you can see which tracking categories are currently active, useful for confirming which tags should be firing on a page an a little easier to read than the OneTrustActveGroups object.
Hopefully this has saved you some time and your implementation is working precisely in line with your privacy policy. If for any reason it isn’t drop us a line. We’d be happy to help with configuration, implementation, or troubleshooting for OneTrust or any other consent management platform.