Skip to content

Instantly share code, notes, and snippets.

@bmcclure
Created February 17, 2020 20:31
Show Gist options
  • Save bmcclure/7b94e3000fa11de66698760f92a5826c to your computer and use it in GitHub Desktop.
Save bmcclure/7b94e3000fa11de66698760f92a5826c to your computer and use it in GitHub Desktop.
OneTrust Cookie Consent snippet for Pantheon
<?php $cookieScriptId = '[SITE_ID]'; ?>
<?php if (!isset($_SERVER['PANTHEON_ENVIRONMENT']) || ($_SERVER['PANTHEON_ENVIRONMENT'] !== 'live')) : ?>
<?php $cookieScriptId .= '-test'; ?>
<?php endif; ?>
<!-- OneTrust Cookies Consent Notice start -->
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" charset="UTF-8" data-domain-script="<?php echo $cookieScriptId; ?>"></script>
<script>
function OptanonWrapper() { }
</script>
<!-- OneTrust Cookies Consent Notice end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment