OneTrust plugin in Joomla: javascript error

125 Views Asked by At

I'm trying to activate OneTrust (cookie manager) plugin in Joomla, pasting the provided JS code straight in the template, just before </body>.

The cookie advice is not appearing and I can see this error in console:

Uncaught (in promise) TypeError: e.hasAttribute is not a function otBannerSdk.js:7:166589

I have no clue where the problem can be.

This is the JS code:

<!-- OneTrust Cookies Consent Notice start for kaochimigraf.com -->

<script type="text/javascript" src="https://cdn.cookielaw.org/consent/XXX/OtAutoBlock.js" ></script>
  
<script type='text/javascript'>
piAId = 'XXXX';
piCId = '';
piHostname = 'web.example.com';

(function() {
function async_load(){
var s = document.createElement('script'); s.type = 'text/javascript';
s.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + piHostname + '/pd.js';
var c = document.getElementsByTagName('script')[0]; c.parentNode.insertBefore(s, c);
}
async_load();
})();
</script>
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"  type="text/javascript" charset="UTF-8" data-domain-script="XXX" ></script>

<script type="text/javascript">

function OptanonWrapper() { }

</script>

<!-- OneTrust Cookies Consent Notice end for kaochimigraf.com -->
0

There are 0 best solutions below