Place scripts at the narrowest correct scope and treat third-party JavaScript as code that affects security, privacy, performance, and reliability.
CMS Max supports named global scripts with active state and injection position, plus scoped scripts on supported pages and reusable theme sections.
Choose the correct scope
- Page script: behavior used only by one page.
- Theme-section script: behavior tied to elements inside one reusable header, footer, or section.
- Global script: behavior required across the site, such as an approved analytics or consent integration.
- Application integration: use a native plugin or supported configuration instead of duplicating provider code when available.
Add a global script
- 01Open Theme Configuration and JavaScript.
- 02Create a clear script name. Make ownership and purpose understandable to future administrators.
- 03Select the injection position. Use the provider or implementation requirement; do not assume every script belongs at the end of the body.
- 04Wrap valid JavaScript in script tags. Keep secrets and private API credentials out of browser code.
- 05Test consent, errors, network activity, performance, and duplicate loading.
