How To Install Google Analytics 4 On Your Website

How To Install Google Analytics 4 On Your Website

If Google Analytics 4 is not installed correctly, your reports are wrong from day one, and you usually do not find out until you are trying to make a decision with the data. There are three ways to install it, plus a fourth option if your website platform has a built-in field for it. This walks through all of them, shows you which one I actually use, and covers the verification step that most guides gloss over. Fair warning on that last part: the checking process is messier in real life than most tutorials admit, and I will show you what that looks like.


1Create your GA4 property and web data stream

Google Analytics 4 property setup screen

Go to Google Analytics and click get started. If you already have an Analytics account, you will land on a dashboard instead, so click Admin in the bottom left and create a new account from there.

  1. Account name. Usually your business name.
  2. Data sharing settings. Leave them or uncheck what you do not want. It does not make a meaningful difference for most businesses.
  3. Property name. I use the domain, like yoursite.com, so it is obvious later.
  4. Time zone and currency. Get the time zone right the first time. Changing it later splits your historical reporting.
  5. Business details. Industry category and company size. This has little effect on your data, so do not overthink it.
  6. Business objectives. Pick Generate leads if you are a service business, or Drive online sales if you are ecommerce. I typically add Understand web or app traffic and View user engagement and retention as well.
  7. Platform. Choose Web. Pick Android or iOS only if you are tracking an app.
  8. Stream details. Enter your website URL and a stream name.

Leave enhanced measurement on. It is enabled by default and you do not need to change anything under it. It gives you scrolls, outbound clicks, site search, video engagement, and file downloads automatically, without setting up a single custom event. More events on your site is a good thing.

Click create and continue, and your stream is live.

Question to Answer:

Is your reporting time zone set correctly, since changing it later fragments your historical data?

2Watch the full tutorial

I install GA4 on a live WordPress site in this video, walk through the plugin options, and show the Tag Manager method I use on my own sites.

How To Install Google Analytics 4 On Your Website

Question to Answer:

What platform is your site on, since that determines which of the four install options applies to you?

3Find your Measurement ID

Right after you create the stream, GA4 pops open a "Set up your Google tag" window. You can follow those instructions, but I close it, because what you actually need is one thing: the Measurement ID.

It starts with G- followed by a string of characters. Click the small arrow next to it to copy it.

If you lose that screen, and it is easy to, here is how to get back:

  1. Click Admin.
  2. Go to Data streams.
  3. Click your web stream.
  4. Click the arrow next to the Measurement ID to copy it.

Data streams is just GA4's word for your website. That is the screen you will come back to any time you need this ID again.

While you are in the stream settings, there is also a View tag instructions option that shows you install methods for common platforms. Worth a look if your platform is listed.

Question to Answer:

Do you have your Measurement ID copied, and does it start with G- rather than AW- or GTM-?

4Option 1: Site Kit or a platform plugin

This is the easiest path and the one Google pushes hardest.

On WordPress, install Site Kit by Google. Go to Plugins, Add Plugin, search Site Kit, install and activate. It connects directly to your Google account and handles the GA4 connection for you. No copying and pasting code.

Site Kit also pulls Search Console and Analytics data into your WordPress dashboard, which some people like and some people find cluttered.

Who this is for: a simple site where GA4 is the only tracking you need. If you are never going to install a Meta pixel, a Google Ads conversion tag, or anything else, this is fine and you can stop reading at section 8.

Who this is not for: anyone who will eventually run ads. Once you have three or four tags to manage, you will wish you had gone the Tag Manager route from the start.

Question to Answer:

Will you ever need to install tracking beyond GA4, like a Google Ads or Meta pixel?

5Option 2: Paste the Google tag into your header

In your data stream settings, choose Install manually. Copy the full JavaScript snippet, not just the Measurement ID. The snippet already has your ID inside it.

That code needs to go as close to the top of the <head> section as possible, on every page of your site.

On WordPress, the plugin I use for this is WP Code. Search for it under Plugins, Add Plugin. Look for the blue logo, listed as WP Code Insert Headers and Footers. Once it is installed and activated:

  1. Click Code Snippets in the left sidebar.
  2. Click Header & Footer.
  3. Paste your Google tag into the Header field.
  4. Click Save Changes.

I find WP Code more user friendly than the other snippet plugins, and the pixels stay put through theme updates as long as nobody deletes them.

On Wix, Squarespace, or Shopify, paste it into the site-wide custom code settings. If you edit HTML directly, put it in your global header template so it appears everywhere.

Before you publish: if an old Universal Analytics script is still sitting in your theme, remove it. Running two Analytics installs at once gives you duplicate pageviews and inflated sessions.

Question to Answer:

Is there old tracking code still hard-coded in your theme that needs removing first?

6Option 3: Install through Google Tag Manager

Google Tag Manager container setup for Google Analytics 4

This is what I actually do, and it is what I would recommend for any business that runs advertising.

The logic is simple. You edit your website code once to install Google Tag Manager, and after that every tag you ever need goes in through the GTM dashboard. GA4, Google Ads conversion tracking, Meta pixel, custom HTML, all of it. You never touch your theme again.

First, install the GTM container. Go to tagmanager.google.com, create an account, and GTM gives you two code snippets. Using WP Code's Header and Footer fields, put the first snippet as high as possible in the header, and the second as high as possible in the body. Save changes.

Then create the GA4 tag inside GTM:

  1. Click Tags, then New.
  2. Name it something obvious. I call mine "Google Analytics 4 Tag."
  3. For tag configuration, choose Google Tag.
  4. Paste your G- Measurement ID into the Tag ID field.
  5. Set the trigger to Initialization - All Pages so it loads before your other tags.
  6. Click Save, then Submit to publish.

Note that the GA4 tag type is called Google Tag, which is confusing, because your Google Ads conversion tag uses the same tag type with a different ID. Naming your tags clearly is what keeps this straight six months from now.

Submitting is not optional. Saving a tag in GTM does nothing on your live site. You have to click Submit and publish the container. This is the single most common reason a setup that looks correct is not collecting data.

If you want the full walkthrough covering GTM, Search Console, and your Google Ads tag together, I covered that in How To Install Google Tag Manager, Analytics 4, Search Console, and Google Tags.

Question to Answer:

Did you click Submit and publish the container, or only save the tag?

7Shopify, Podia, and platforms with a built-in field

Before you do any of the above, check whether your platform has a native connection. Plenty do, and it is almost always the better option.

Shopify. Connect GA4 directly through Shopify's own integration rather than pasting code. When you do, Shopify automatically sends a set of key events into GA4: purchase, begin_checkout, add_to_cart, and others. You get real ecommerce tracking without building a single custom event. Doing it manually means rebuilding all of that yourself.

Course and membership platforms. Podia is a good example, and I used it for one of my own sites. There is a single field for your Google Analytics tracking ID. You paste in the Measurement ID from Admin, Data streams, and save. That is the whole install.

That is worth saying clearly, because people get confused by the terminology: the "Google Analytics tracking ID" a platform asks for is your Measurement ID. The G- value. Same thing, different name.

The general rule: if your platform offers a direct connection, use it. If it does not, the Tag Manager route works in almost every case.

Question to Answer:

Have you checked whether your website platform has a native GA4 connection before pasting code anywhere?

8Verify it is working

Now confirm the thing actually works, and be prepared for this to be less clean than you expect.

Tag Assistant. Install the Google Tag Assistant Chrome extension, go to your site, and click the extension. You should see your Google Tag Manager container and your Google tag.

Here is the honest part. When I did this on a live site, Tag Assistant showed the GTM container but not the Google tag. I refreshed. Still nothing. I navigated to a different page on the site and checked again. Still nothing. Everything was configured correctly, the workspace was published, the version was live. It was a caching issue.

So do not immediately start tearing your setup apart. Clear your cache, or open the site in a fresh window, before you assume something is broken.

GTM Preview mode. In Tag Manager, click Preview, enter your URL, and connect. This gives you a debug session showing exactly which tags fire, when, and what data they send. This is more reliable than the extension for confirming a tag is configured properly.

GA4 Realtime. Go to Reports, then Realtime, and visit your site from another browser or device. Check three things:

  • Your visit appears under users in the last 30 minutes.
  • page_view shows in the event count card.
  • Your key events appear if you have set any up yet.

Even Realtime has slight delays sometimes. In my case the first user showed up a minute or two after I expected it. That is normal.

DebugView. For a closer look, DebugView streams events from your device as they fire, with all their parameters. Use this when you need to see exactly what data an event is carrying, not just that it happened.

Question to Answer:

Have you cleared your cache and checked from a second device before concluding the install failed?

9Key events: what GA4 calls conversions now

One terminology update that trips people up. GA4 no longer calls them conversions. They are key events. Google Ads still uses the word conversions, so you will see both terms depending on which interface you are in.

In GA4, everything is an event. Enhanced measurement gives you a lot of them automatically. What you have to do is tell GA4 which ones represent actual business results by marking them as key events.

Business Type Mark These As Key Events How It Fires
Local service business Form submission, phone click, quote request Thank-you page view or a form submit event in GTM
Ecommerce purchase, sometimes begin_checkout Automatic if your platform connection is set up
Lead generation Booked call, demo request, quote form Confirmation page view or a form trigger
Content or membership Sign-up, content download Button click trigger in GTM

Start with three to five. Mark the actions that genuinely represent revenue or a real lead. If leads and sales are your goal, keep newsletter signups out of that primary set. They still matter, but mixing them in makes your reporting harder to read and gives your bidding algorithms mixed signals.

Confirm the event exists before you mark it. Check DebugView or Realtime first. Marking an event as a key event does not create it, and if it is not firing you will have a key event that never records anything.

Question to Answer:

Which three actions on your site represent real business results, and are they all firing as events right now?

10Common problems and how to fix them

Symptom Likely Cause Fix
No data at all Wrong Measurement ID Compare the ID in your tag against Admin, Data streams, character by character
Tag fires in Preview but not live GTM container never published Click Submit and publish. Preview alone changes nothing on your live site
Doubled pageviews and sessions Two installs running at once Pick one method. If you use GTM, remove the hard-coded script from your theme
Tag Assistant shows nothing Browser or site caching Clear cache, try a new window, check a second page before assuming it is broken
Data on desktop, not mobile Browser privacy settings blocking tags Test on both. Some blocking is expected and not fixable
Gaps in traffic between pages Tag missing from some templates Confirm it loads on your homepage, a service page, and a blog post
Key event recording nothing The underlying event never fires Verify in DebugView before marking anything as a key event

One more thing on timing. Realtime should show you within a minute or two, but processed data in your standard reports can take up to 24 hours to appear. If your conversions are not showing in GA4 or in Google Ads immediately after setup, that is expected. Give it a day before you troubleshoot.

Question to Answer:

Have you confirmed only one GA4 install is running, with no leftover hard-coded script alongside a GTM tag?

In Summary

Create your GA4 property, add a web data stream, leave enhanced measurement on, and copy your Measurement ID from Admin, Data streams. Then pick exactly one install method. A plugin like Site Kit if GA4 is all you need. The Google tag pasted into your header if you want it simple. Google Tag Manager if you run ads or expect to add more tags, which is what I use and recommend for most businesses.

Check for a native connection first. Shopify's direct GA4 integration automatically creates purchase, begin_checkout, and add_to_cart key events, and course platforms like Podia just want your Measurement ID pasted into a single field. Those are less work and less breakable than pasting code.

Then verify before you trust anything. Tag Assistant, GTM Preview, and GA4 Realtime, and clear your cache before you panic, because caching makes a working install look broken more often than you would think. Mark three to five key events that represent real business results and confirm each one fires before you mark it. If you want help getting your tracking set up right, schedule a free consultation.

0 comments

Leave a comment