OneTrust script not loaded - missing document.write support?


we’re using OneTrust for consent management and want to display the consent banner via Matomo Tag Manager. Currently, we’re using Google Tag Manager, but want to switch to MTM.

With GTM, we can display the consent banner by using a custom html tag with the setting “support document.write”. In MTM, I can’t find a setting for supporting document.write.
Problem at the moment: the consent banner won’t be displayed via MTM.

We see this error message in the browser console:
Failed to load resource: the server responded with a status of 404 () (in

The OneTrust support insists that support “document.write” needs to be selected with GTM. But they have no experience with MTM.

Is there a possibility to change setting for “support document.write” in a custom html tag?
Or might it be another problem that is not connected to the support of document.write?

Thanks a lot for your help!

Hello christine.
We’re experiencing the same issue. Have you found a solution since your initial post six months ago?


I am facing the same problem as you.

I found an example that works with Tealium and seems to work for matomo tag manager.

Here is the code to insert:

<script type="text/javascript">
    let domainId = '[INSERT DATA DOMAIN ID]';

    let head = document.getElementsByTagName('head')[0];
    let script = document.createElement('script');
    script.type = 'text/javascript';
    script.src = '';
    script.setAttribute("data-domain-script", domainId);
    script.async = true;
    function OptanonWrapper() { }

Ex from Onetrust/Tealium :