Third-party scripts and head markup in an LWR store
Key Takeaway
To load global third-party JavaScript from an external host in LWR head markup, use the privileged <x-oasis-script> tag rather than a plain <script> tag. On the default Strict CSP, inline scripts do nothing, so move the code into a static resource referenced by a relative URL.
An LWR store lets you add custom markup to the page <head> in Experience Builder. You use that markup to load site-wide third-party JavaScript, analytics tags, SEO meta tags and favicons. Whether those scripts actually run depends on the site's Content Security Policy (CSP) security level and on which external hosts you have added as trusted sites.
What head markup is
Typical uses of head markup are:
- custom analytics, for example Adobe Analytics or Google Tag Manager
- SEO meta tags that only search engines see
- a favicon
Google Analytics is supported out of the box, so it does not need head markup. You must still configure it for the site.