By Hira Ads Pro·2 min read·October 12, 2026
WordPress makes it easy to add tracking, which is also why so many WordPress sites have too much of it: a GA4 plugin, a theme setting, a Pixel plugin and a GTM container all firing at once. A clean setup starts with one place for tags.
1. Install Google Tag Manager once
Add the GTM container with one method only:
- A dedicated GTM plugin, such as GTM4WP, which also adds a useful dataLayer
- Or the theme’s header and body code fields
Then remove other tracking that duplicates it: GA4 plugins, Pixel plugins, or gtag code pasted into the theme. Run Tag Assistant afterwards to confirm each tag loads once.
2. Track form plugins on success
Each form plugin signals success differently. Trigger your lead event from that signal, not from the submit button click.
| Plugin | Reliable success signal |
|---|---|
| Contact Form 7 | The wpcf7mailsent DOM event |
| Gravity Forms | Confirmation redirect or gform_confirmation_loaded |
| WPForms | Confirmation redirect or a success message element |
| Elementor Forms | A redirect after submit, or a success listener |
The simplest universal option is a thank-you page per form, set as the form’s redirect. If you need more detail (which service, which form), push a dataLayer event:
document.addEventListener('wpcf7mailsent', function (e) {
window.dataLayer.push({ event: 'generate_lead', form_name: 'cf7_' + e.detail.contactFormId });
});
3. WooCommerce purchases
For WooCommerce, use a GTM plugin or extension that pushes the standard GA4 ecommerce events (view_item, add_to_cart, begin_checkout, purchase) to the dataLayer. Check that purchase fires only once per order, including when the customer reloads the order-received page.
4. Google Ads and Meta
With the dataLayer in place, the same events feed every platform from GTM:
- Google Ads conversion tag on
generate_leadandpurchase, plus a Conversion Linker tag - Meta Pixel
LeadandPurchase, with aneventIDif you also use the Conversions API
For the Conversions API on WordPress, use either an official integration or server-side GTM. Do not run both for the same events.
5. Watch out for caching and optimisation plugins
Caching and “delay JavaScript” settings can stop GTM or inline scripts from running until the visitor interacts. Exclude your GTM snippet and dataLayer scripts from delay and combine settings, then retest.
6. Test
- GTM Preview while submitting each form
- GA4 DebugView for event names and parameters
- Google Ads and Meta test tools for conversions
WordPress tracking is one of the most common tracking audits we run, usually to remove duplicates and fix form triggers.
Want this set up properly on your site?
Request an audit and get a clear plan before any changes are made.
Request an Audit →