Using TCF with Header Bidding (TCF Stub)
To improve performance and site load time, you can load the TCF stub and the OneTrust banner independently of one another.
To load the TCF stub independently
To load the TCF stub before the banner script loads, you need to add the following tag to the head section of your website, before any header bidding scripts.
<script src="https://cdn.cookielaw.org/consent/tcf.stub.js"" type="text/javascript" charset="UTF-8"></script>
You will not need to make any changes to the banner script tag.
Example:
<html>
<head>
<script src="https://cdn.cookielaw.org/consent/tcf.stub.js"" type="text/javascript" charset="UTF-8"></script>
<!-- OneTrust Cookies Consent Notice start -->
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"" type="text/javascript" charset="UTF-8" data-domain-script="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"></script>
<script type="text/javascript">
function OptanonWrapper() { }
</script>
<!-- OneTrust Cookies Consent Notice end -->
</head>
</html>
Prebid
If you use Prebid for Header Bidding, please see our Using TCF with Prebid article for more information.
Updated 9 months ago