Knowledgebase

How to add Google Analytics 4 and Google Tag Manager to WordPress

Google Analytics 4 (GA4) shows you how many people visit your site, where they come from and what they do. Google Tag Manager (GTM) lets you manage GA4 and other tracking codes from one place without editing your theme. This guide shows you how to add Google Analytics 4 and Tag Manager to WordPress, either with Google's Site Kit plugin or through GTM.

Step 1: Create a GA4 property

  1. Go to analytics.google.com and sign in with the Google account you want to own the data (preferably a company account, not a staff member's personal one).
  2. Open Admin and create an account and a property. Set the time zone to Egypt and the currency to EGP if that matches your business.
  3. Choose Web as the platform and add a data stream with your website URL.
  4. Copy the Measurement ID, which looks like G-XXXXXXXXXX.

Option A: Site Kit by Google (simplest)

  1. In WordPress go to Plugins > Add New, search for Site Kit by Google, install and activate it.
  2. Click Start setup and sign in with the same Google account.
  3. Connect Analytics and choose your GA4 property. Site Kit adds the tag for you.
  4. You can also connect Search Console to see search data in your dashboard.

Option B: Google Tag Manager (more flexible)

Use GTM if you also plan to add the Meta Pixel, Google Ads conversions, or click tracking (for example WhatsApp button clicks).

  1. Go to tagmanager.google.com, create an account and a Web container. Note the container ID, like GTM-XXXXXXX.
  2. Add the GTM code to WordPress. The easiest way is a GTM plugin (for example "GTM4WP"), where you paste only the container ID. Alternatively, your theme or a header/footer plugin can hold the two snippets GTM gives you: one in the <head> and one right after the opening <body> tag.
  3. In GTM, click Add a new tag, choose Google Tag, and paste your G-XXXXXXXXXX Measurement ID.
  4. Set the trigger to Initialization - All Pages (or All Pages).
  5. Click Preview to open Tag Assistant, load your site, and confirm the Google Tag fired.
  6. Click Submit and then Publish. Nothing goes live until you publish.
Install GA4 once only. If you use GTM, do not also add GA4 through Site Kit, your theme or another plugin. Duplicate tags double your page views and break your reports.

Step 3: Check that data arrives

  1. Open your site in another browser or on your phone.
  2. In GA4, open Reports > Realtime. You should see your visit within a minute or two.
  3. Standard reports can take up to 24-48 hours to fill.

Useful next steps

  • Mark important actions as key events (for example a form submission, a WhatsApp click or a purchase).
  • For WooCommerce, use a plugin or GTM setup that sends e-commerce events (view item, add to cart, purchase).
  • Link GA4 with Google Ads and Search Console from the GA4 Admin area.
  • Add the Meta Pixel too if you advertise on Facebook and Instagram: see how to add the Meta (Facebook) Pixel to WooCommerce.

Common problems

  • No data in Realtime: your cache may serve old pages without the tag. Purge your cache plugin and Cloudflare. Ad blockers in your own browser can also hide your visit.
  • Double page views: GA4 is installed twice. Check the page source for two G- tags.
  • GTM Preview cannot connect: make sure the container is installed on the exact domain (with or without www) and disable aggressive JavaScript optimisation for the GTM script.

Frequently asked questions

Do I need a cookie consent banner?

It depends on where your visitors are. If you target visitors in the EU or other regions with privacy laws, use a consent banner and Google Consent Mode. Check the rules that apply to your business.

Site Kit or Tag Manager?

Site Kit is enough if you only need GA4. Choose Tag Manager if you will manage several tracking codes and events.

Will analytics slow down my site?

A single GA4 tag has little impact. Many tags and tracking scripts add up, so keep only what you use. See how to speed up your WordPress website.

Want help with tracking and search performance? See our SEO services.

Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.

  • Google Analytics 4, GA4 WordPress, Google Tag Manager, GTM WordPress, Site Kit, website analytics, ربط جوجل أناليتكس, جوجل تاج مانجر

Was this answer helpful?

0 Users Found This Useful