OneTrust SDK是如何在Javascript中安装的



我正在尝试运行以下代码行

  OneTrust.OnConsentChanged(() => {
        alert("consent changed");
    });

不出所料,我收到错误消息:'OneTrust' is not defined.

然而,我在OneTrust文档中找不到任何解释如何导入OneTrust对象的地方。

上述函数可在这些文档中找到。

请有人解释一下如何导入OneTrust对象?

尝试

window.OneTrust.OnConsentChanged(() => {
        alert("consent changed");
    });

OneTrust的脚本加载到<head>标签中后,SDK开始可用,如下所示:

<head>
    <script type="text/javascript" charset="UTF-8" data-domain-script="xxxxx-xxxxx-xxxxx-xxxxx" src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"></script>
    <script type="text/javascript">function OptanonWrapper() {}</script>
// rest of the elements inside head tag
</head>

最新更新