HomeIntegrations & Platform Patterns › Third-party frontend integrations

Third-party frontend integrations

Purpose: Add analytics, tag managers, consent, chat and A/B tools without wrecking performance, privacy or stability.

Who this page is for

AudienceWhy it matters to you
Frontend engineersOwners of the page
Tech leadsGovernance of what gets added

The governance problem

Third-party scripts arrive via marketing ("just add this tag") and accumulate. Each one is arbitrary code executing on your users with your origin's privileges. Treat additions as changes requiring review, with an owner and a removal date where applicable.

Integration mechanics in AEM

NeedMechanism
Site-wide scripts (analytics, tag manager)Page component customheaderlibs/customfooterlibs HTL, config-driven (page property or context-aware config for the ID) — NOT hardcoded
Per-environment IDsContext-aware config / OSGi config per run mode (prod ID never fires on stage)
Consent gatingConsent manager loads first; other tags load only per consent state
Component-scoped widget (chat)The component's clientlib, lazily

Performance rules

Privacy & security rules

Quick navigation