2

I want to add the following scripts to my public/index.html if REACT_APP_COOKIE_BAR is true. That however leads to script tags in a script and it seems to break my code. Do you have any advice on how to fix that?

<!-- OneTrust Cookies Consent Notice -->
<script type="text/javascript">
  if ("%REACT_APP_COOKIE_BAR%" === true) {
    <>
      <script 
      type="text/javascript"
      src="https://cdn.cookielaw.org/consent/12345/OtAutoBlock.js"
      />
      <script
      src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"
      type="text/javascript"
      charset="UTF-8"
      data-domain-script="12345"
      />
      function OptanonWrapper() { }
    </>
  }
</script>
2

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.