Using the OptanonWrapper Callback Function
作者:互联网
Using the OptanonWrapper Callback Function
In the Testing CDN and the Production CDN in your OneTrust Cookie Consent application, you will notice a script containing the below.
<script type="text/javascript">
function OptanonWrapper() { }
</script>
This is the OptanonWrapper
callback function.
A callback function is a function passed into another function as an argument, which is then invoked inside the outer function to complete some kind of routine or action.
In the case of the OneTrust CDN, the OptanonWrapper
function is called after banner script execution.
You can use the OptanonWrapper
function to listen for a user event and determine script behavior based on the user event.
For example, a common use of the the OptanonWrapper
function creating the event, OneTrustGroupsUpdated
, to push values to the dataLayer
after user consent, before page reload or navigation.
<script type="text/javascript">
function OptanonWrapper()
{window.dataLayer.push({event:'OneTrustGroupsUpdated'})}
</script>
标签:OptanonWrapper,function,Function,script,CDN,user,Using,event 来源: https://www.cnblogs.com/chucklu/p/16497555.html