Google Tag Manager (GTM) is the one piece of tracking code you install by hand; everything else — analytics, pixels, conversion events — goes inside it and can be changed without touching the website again. Setting up Google Tag Manager for WordPress takes ten minutes. The part that takes longer, and that most guides get wrong, is tracking form submissions correctly.
This is the setup I use on client sites. It assumes you want the basics that matter for a business website: page views in GA4, form submissions, phone-number clicks and clicks on key buttons. If you have not decided which events to track yet, read the conversion tracking guide first; this article is the WordPress-specific mechanics.
Step 1: Create the container
At tagmanager.google.com, create an account for the business and a “Web” container for the site. GTM shows two code snippets: one for the <head> and one for immediately after the opening <body> tag. Keep the page open.
Step 2: Add the snippets to WordPress (without a heavy plugin)
Three sensible options, in order of preference:
- The theme’s own header/footer code fields. Many themes (and Elementor Pro’s Custom Code feature) let you paste code into the head and body. Elementor Pro: Elementor → Custom Code → Add New, location <head> for the first snippet, <body> start for the second, display conditions “Entire site”.
- A child theme. A few lines in
functions.phphooked towp_headandwp_body_open. Cleanest, survives theme updates, no plugin. - A lightweight snippets plugin. Fine if neither of the above is available. Avoid plugins that “manage” GTM with dozens of options — the data layer features they add are rarely used and they load on every page.
Whichever route, the head snippet must be in the <head> (not the footer), or GTM loads late and events that happen during page load can be missed.
Step 3: Verify it loaded
Click Preview in GTM, enter your site URL, and connect. The Tag Assistant panel should show “Connected” and a list of events (Initialization, Container Loaded, DOM Ready, Window Loaded). If it does not connect, the snippet is in the wrong place or a caching plugin is serving an old copy of the page — clear the cache and try again.
Step 4: Add GA4
In GTM: Tags → New → Google Tag. Paste your GA4 Measurement ID (G-XXXXXXX). Trigger: Initialization – All Pages. Save, and in Preview mode confirm a page view appears in GA4’s Realtime report. Do not also run a GA4 plugin on the site; you will double-count every visit. The speed checklist has the same advice from the other direction — one analytics installation, not two.
Step 5: Track form submissions — the right way
The mistake almost every tutorial makes: firing a tag on the “Form Submission” trigger or on a click of the submit button. Both fire before the form is validated, so spam, failed submissions and people who clicked and then fixed a typo all count as conversions. Fire on success instead.
Elementor forms
Elementor Pro’s form widget fires a JavaScript event called submit_success on the form element when a submission is accepted. Push it to the data layer with a small custom HTML tag that runs on all pages:
<script>
document.addEventListener('DOMContentLoaded', function () {
jQuery(document).on('submit_success', function (e) {
var form = e.target && e.target.closest ? e.target.closest('form') : null;
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'form_submit',
form_name: form ? form.getAttribute('name') || form.id : 'elementor'
});
});
});
</script>
Then create a Custom Event trigger in GTM with event name form_submit, and a GA4 Event tag named form_submit that fires on it (send form_name as a parameter). Mark form_submit as a key event in GA4.
Forms that redirect to a thank-you page
Simpler: fire the GA4 event on a Page View trigger where the page path contains /thank-you. Make sure the thank-you page is noindexed and not reachable any other way, or you will count direct visits.
Contact Form 7, WPForms, Gravity Forms
Each fires its own JavaScript event on success (wpcf7mailsent, wpformsFormSubmitSuccess, gform_confirmation_loaded). The pattern is identical: listen for the event, push form_submit to the data layer, trigger the GA4 tag from it.
Step 6: Track phone clicks
In GTM, enable the built-in Click URL variable, then create a trigger: Click – Just Links, fire on Some Link Clicks where Click URL starts with tel:. Attach a GA4 Event tag named phone_click. On mobile this is often the most frequent conversion for local businesses, and it takes two minutes.
Step 7: Track key buttons
For “Book a call” or “Get a quote” buttons that open a calendar or scroll to a form, use Click – All Elements with a condition on Click Classes or Click Text. Better still, give the button a specific CSS class or ID in Elementor (Advanced → CSS ID) and match on that, so a copy change does not break the trigger. Name the event cta_click with the button text as a parameter. This is not a conversion — it is an engagement signal — so do not mark it as a key event.
Step 8: Keep it fast
GTM itself is light; the tags inside it are what slow pages. Two rules:
- Fire heavy tags (chat widgets, heatmaps, video players) on Window Loaded or on first interaction, not on Initialization.
- Audit the container quarterly and pause anything nobody looks at.
Step 9: Test on a phone, in a private window
With Preview mode and GA4 Realtime open: submit the form (one form_submit), tap the phone number (one phone_click), click the CTA (one cta_click). Check for double firing — a very common result of having both a click trigger and a success trigger on the same form. Then Submit the container version with a descriptive name. Nothing in GTM is live until you publish.
| Event | Trigger | Key event? |
|---|---|---|
| page_view | Google Tag, Initialization – All Pages | No |
| form_submit | Custom Event from the form’s success hook | Yes |
| phone_click | Link click, URL starts with tel: | Yes |
| book_call | Calendar confirmation page or widget event | Yes |
| cta_click | Element click by CSS ID | No |
Consent, if you have EU or UK visitors
Add a consent tool that supports Google Consent Mode v2 and set GTM’s consent defaults to “denied” for analytics and ad storage until the visitor accepts. GA4 will model what it cannot measure. If all your visitors are in the US this is optional, but it is not harmful and it future-proofs the setup.
Further reading: Google Tag Manager Help.
FAQ
Do I need a plugin to add Google Tag Manager to WordPress?
No. The container snippet can be added through the theme’s header settings, a small code-snippets plugin, or a child theme. Dedicated GTM plugins work but add options and weight you rarely need.
Why does my GTM form trigger fire when the form fails?
Because it is watching the submit button click or the browser’s generic submit event, both of which happen before validation. Fire on the form’s success event or the thank-you page instead.
Can Google Tag Manager slow down my website?
The container itself is small. What slows sites is the tags inside it — chat widgets, heatmaps, multiple pixels. Keep the container lean and load non-essential tags after page load.
How do I test that a tag is working?
Use Tag Manager’s Preview mode alongside GA4’s Realtime report. Perform the action on a phone in a private window and confirm the tag fires exactly once and the event appears in GA4.
If your forms are counted twice, or not at all, send me the site — a tracking audit is usually a twenty-minute look and an afternoon’s fix.