-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: update cookie consent banner script #334
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/commercetools/commercetools-docs-kit/8m1udb2y2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkuehn I pushed a commit to:
- render scripts as list elements (
setPostBodyComponents
accepts a list of react components), no need for rendering them together with a fragment - render the script elements with the defer option
This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. async has a similar effect in this case.
@emmenko thanks for spotting that you can pass a list (which is obvious by the name of the function, but I just did not take enough car). Concerning deferring the execution I am not very inclined to restart the debug cycle with that horrible script. I am pretty sure that I already tried deferring the execution and it did not work or caused weird things like two complete cookie consent instances laid over each other, rendering the page overlay as black. Another reason why I'm hesitant is that we can't really test it as easily without actually running it on a commercetools.com domain in production. |
There should be no issue with
The purpose of the attribute is just to eliminate the blocking of the parse phase of the browser. However, the script will still be loaded and executed before the page is officially loaded. Anyway, if you still prefer to keep it out I can change that. |
@emmenko sorry, clicked "update from master" which is not a rebase. Let's try defer, by spec it should work - we just need to be very fast in rolling a complete kit release cycle when we find out it's blocking the complete custom apps docs after go-live on a commercetools.com domain. |
I can try this in the custom apps docs first |
We received a new cookie consent banner ID for the docs kit, here's my try to implement it correctly.
The raw script copy/paste we received form Marketing is: