After adding the cookie consent script to the theme, I checked the browser’s console and saw multiple scripts from the Cookie consent manager were being blocked due to Content Security Policy. I added those to the content security policy script src site setting and the cookie consent banner is displayed correctly now.