Published: 11 August 2026

Google Tag Manager in WordPress: 3 setup methods compared

GTM4WP, Site Kit or the theme editor: three ways to add Google Tag Manager to WordPress, compared, with GDPR consent wiring, not just plugins.

Daniils Visnakovs
· Reading time: 7 min

Setting up Google Tag Manager in WordPress means, in most guides, installing a plugin, entering the container ID, done. That’s not wrong, just incomplete. The container is empty afterwards, measures nothing useful, and without consent wiring it’s a legal problem in Germany anyway. Here are the three technical ways to get GTM into WordPress, and what’s still missing afterwards to make the tracking actually worth anything.

1. GTM4WP: the plugin for developer control

GTM4WP (officially “Google Tag Manager for WordPress”, by duracelltomi) is the most widely used GTM plugin. It drops the container snippet into <head> and <body> and automatically pushes WordPress and WooCommerce events into the dataLayer: page views, post categories, and for WooCommerce, e-commerce events like view_item or add_to_cart.

The upside: you get a cleanly populated dataLayer without writing any code yourself, and you keep full control over tags, triggers and variables inside GTM. The downside: GTM4WP fills the dataLayer, but it doesn’t pick up the events on its own. You still have to configure the GA4 event tag and the matching variables in GTM yourself. For a ready-made WooCommerce container with every dataLayer variable already wired up, I’ve built that in advance: GTM template for WordPress e-commerce tracking.

2. Site Kit by Google: the official but limited route

Site Kit is Google’s own WordPress plugin, and since an update it also connects GTM containers without you writing any code into the theme files. Setup runs through a guided assistant right in the WordPress dashboard, including linking to Search Console, GA4 and Google Ads.

The catch: Site Kit is deliberately kept simple. It places the container reliably, but doesn’t handle dataLayer events or consent logic, that’s still better handled by GTM4WP or a custom implementation. Site Kit fits best when you want the bare container live fast and plan to configure the events in GTM yourself anyway.

3. Manually in the theme editor: no plugin, but risk

The third way: drop Google’s two GTM snippets directly into header.php (right after the opening <body> tag) and into functions.php or a child theme. No extra plugin, full control over placement.

The downside is just as direct: a WordPress update overwrites the theme, and the container disappears without warning, which is why this only works with a child theme, never the main theme. And a typo in functions.php can, in the worst case, take the entire site down. I’d only choose this route if you already maintain a properly kept child theme and know exactly what you’re doing. For most WordPress operators, GTM4WP is the better trade-off between control and safety.

The container now sits in the page, but in Germany it isn’t allowed to simply send data to Google before someone has consented. That applies not just to cookies but to loading the script itself. Without a correctly wired CMP (consent management platform) and Google Consent Mode v2, your conversion data falls away the moment someone declines or hasn’t decided yet, and you end up optimizing Google Ads on a data set that’s systematically incomplete. I’ve written up what the consent wiring actually looks like here: Consent Mode v2 setup.

The bottom line

Which of the three routes is right depends on how much control you need: Site Kit for the fast, official entry point, GTM4WP for cleanly populated dataLayer events without writing your own code, the theme editor only with a child theme and experience. In all three cases the same thing is true: the container alone measures nothing. Only GA4 tags, correct triggers and a working consent connection turn the empty container into a tracking setup you can actually trust.

If you’d rather skip the setup work: the GTM configurator has ready-made, importable container templates, including for WordPress.


Daniils Visnakovs

About the author

Daniils Visnakovs

Independent sparring partner for Google Ads economics and measurement quality. Daniils did technical measurement implementation work for Google. Today he helps teams make better decisions and keep the knowledge in-house: in 1:1 consulting, workshops or on stage.