JStatsMATOMO · ANALYTICS · JOOMLA 4 & 5

Integration & tools · Knowledge

How do I add Google Analytics 4 to Joomla?

Technically, GA4 is embedded exactly like Matomo: its gtag.js snippet belongs in the head section of every page – a system plugin is the cleanest carrier.

The bigger difference is legal, not technical: GA4 sets cookies and transfers data into the Google ecosystem – in the EU that means a real consent banner before the tag fires.

Setup in minutes – obligations for longer

The setup itself: create a GA4 property, copy the measurement ID and the gtag.js snippet, paste it into a head-injecting plugin – JStats accepts GA4 snippets exactly like Matomo ones (yes, our plugin is tracker-agnostic; the recommendation for Matomo elsewhere on this site is editorial, not technical). Verify in the page source that the snippet appears once, then check GA4's realtime view. What follows is the duty part: because GA4 stores identifiers on the visitor's device and processes data on Google servers, EU sites need prior consent – the tag must stay silent until the visitor agrees, which requires a consent solution that actually blocks scripts, not just displays a banner. Your privacy policy needs a GA4 section, and Google's data processing terms must be accepted in the account. If that list feels heavy for a site that mainly wants visit counts, that is precisely the case for cookieless Matomo – the comparison question next door lays out both sides fairly.

Key facts

Related questions

All knowledge topics