For the AppExchange Security Review, strict requirements apply to loading third-party JavaScript and front-end assets:
**General Requirements:**
- All front-end assets, such as JavaScript and CSS files, must be packaged as static resources
- External JavaScript libraries must be saved in the static resources folder of your package and referenced using a `$Resource` URL
- Dynamically loading JavaScript files from third-party endpoints, content delivery networks (CDNs), or external sources is not permitted
- This ensures that the code is version-controlled and that any changes are tracked through the package version ID
**Specific Exceptions:**
- Google Maps and Stripe libraries are allowed for dynamic loading
- Captcha is permitted on experience sites and public pages
- CSS can be dynamically loaded if an integrity check is implemented
**No Exemptions Policy:**
- Exemptions for loading third-party scripts, like Google Tag Manager, from external sources instead of static resources are not allowed
- Loading external JavaScript like Google Tag Manager directly without storing it as a static resource is not permitted
- No waivers are available for external JavaScript that "shouldn't be stored as static resources"
**Security Implications:**
- Using CDN links in Visualforce pages can introduce vulnerabilities, as externally managed code can change without the package version ID changing
- This prevents administrators and the Salesforce security review team from being aware of changes
- Salesforce cannot ensure that third-party code remains secure when loaded dynamically
**Alternative Approaches:**
- Consider hosting dynamic content externally and embedding it via an iframe into a Visualforce page, as this approach is not associated with the Salesforce domain
- Use secure methods such as the `$Resource` URL for JavaScript or the `<ltng:require>` tag for CSS in Lightning components