How To Add Google Analytics To Your Website

To add Google Analytics 4 to your website, you need to create a GA4 property, get a measurement ID, and place the Google tag snippet on every page. You can install the tag directly in your HTML, via Google Tag Manager, or through a CMS integration.

This guide walks you through each method, from creating an Analytics account to confirming that data appears in your reports. You will also find the exact click paths, the required roles, and the edge cases that trip up new setups.

What You Need Before You Start

A Google Account is the only hard requirement. You will use it to sign in at analytics.google.com. For account creation, your account needs the Viewer role at the account level. To create a property, you need the Editor role on the account. To add a data stream, you need the Editor role on the property. If you are the person who creates the account, you automatically have the necessary roles.

You also need access to your website’s HTML or to your CMS admin panel. The installation methods later in this article assume you can paste a code snippet or enter a tag ID. Once your web stream exists, you will copy its GA4 measurement ID (it starts with “G-” or “AW-”). You will find it under Admin > Data streams, inside the stream details of your web stream.

A single Google Analytics account can hold up to 2,000 properties. If you already have an account for another business, you can create a new one to keep data separate. The property time zone you choose only affects data going forward; changing it later can cause a flat spot or a spike in your reports. Google recommends changing the time zone no more than once per day.

Create A GA4 Account, Property And Web Stream

If you have never used Google Analytics, go to analytics.google.com and click Start Measuring. Otherwise, open Admin (the gear icon at the bottom left) and click Create, then select Account. Give the account a name, configure the data-sharing settings, and click Next to add your first property.

On the property setup screen, enter a name for the property, pick a reporting time zone, and choose a currency. If you select a time zone that observes Daylight Savings Time, Analytics adjusts automatically. Use Greenwich Mean Time if you prefer no DST shifts. Click Next, select your industry category and business size, then click Next again and indicate how you plan to use Analytics. This choice tailors the default reports: for example, “Generate more leads” surfaces lead-generation reports. Click Create and accept the Terms of Service if prompted.

Click path: Admin then Create then PropertyAdminCreateProperty
The property setup screen where you choose a name, time zone, and currency.

Now add a data stream. In Admin, under Data collection and modification, click Data streams. Click Add stream and choose Web. Enter your primary website URL (like “example.com”) and a stream name. Keep enhanced measurement enabled: it automatically collects page views, scrolls, outbound clicks, and other events. You can disable individual events later. Click Create stream. Your GA4 property now has a web data stream and is ready for the tag installation.

Short on time? Analytics Art can check this in your property for you.

Install Option 1: Paste The Google Tag

This method places the gtag.js snippet directly on every page of your site. In Admin, go to Data streams and click your web stream. Under Google tag, click View tag instructions. On the Installation instructions page, select the Install manually tab.

Click path: Admin then Data streams then Web stream then View tag instructionsAdminData streamsWeb streamView tag instructions
The Google tag snippet you copy and paste into your website’s HTML.

You will see a JavaScript block that starts with <!-- Google tag (gtag.js) --> and ends with </script>. Copy the entire snippet. Paste it immediately after the opening <head> tag on every page of your website. If you use a server-side include or a template engine, add the snippet to the shared header file so it appears once per page.

Data collection can take up to 30 minutes to begin. After that, open Reports > Realtime in Google Analytics to see incoming activity. If you do not see a Data streams option, use the property selector to confirm you are in the new property you just created.

For sites that already run an older analytics.js snippet, remove that legacy code before adding the Google tag. The snippet can accommodate multiple tag IDs, but it should appear only once per page.

Install Option 2: Google Tag Manager

Google Tag Manager lets you deploy and update the Google tag without editing your site’s HTML. You need a Tag Manager container already installed on your website and a GA4 property with a web data stream.

Sign in to tagmanager.google.com, open your container, and go to Tags. Click New, then Tag Configuration > Google Analytics > Google Analytics. This is the recommended destination tag type. In the Tag ID field, enter your measurement ID (the “G-” ID). Under Triggering, select Initialization - All Initialization Events so the tag fires early on every page. Click Save.

Optional settings let you control how the tag communicates with GA4. In Configuration settings, you can add parameters like server_container_url to route data through a server-side container. Shared event settings let you attach parameters (such as currency) to every event the tag sends. To track custom user properties, create a Google Tag Event Settings variable and assign it to the tag; you can set up to 25 user properties per property. The alternate method, choosing Google Tag as the tag type, offers the same options but is not the recommended path.

Before publishing, verify the tag fires correctly. In the Tag Manager workspace, click Preview, enter your website URL, and Connect. This launches Google Tag Assistant in debug mode, showing which tags fired and what data they sent. Check the Summary tab for your Google tag and any events. When you are confident, click Submit in Tag Manager, choose Publish and Create Version, add a version name and description, and click Publish. For a detailed walkthrough, see how to set up GA4 with Google Tag Manager.

Install Option 3: Your CMS Or Website Builder

Many content management systems and website builders offer a native field where you can paste your Google tag ID. The platform then injects the full Google tag automatically. To find your measurement ID, open Admin > Data streams, click your web stream, and copy the Measurement ID under Stream Details.

The table below shows which method each supported CMS uses, based on Google’s documentation (source).

CMS / BuilderMethod
Blogger, Drupal, Duda, GoDaddy, Google Sites, HubSpot, Magento, MonsterInsights (WordPress), One.com, Shopify, Site Kit (WordPress), Squarespace, Typo3, Wix, WooCommercePaste measurement ID in the dedicated Google Analytics field
Cart.com, PrestaShop, Salesforce (Demandware), VTEXContact the platform’s support for instructions
WeeblyFollow Weebly’s own instructions
All other builders without a dedicated fieldUse the custom HTML feature to paste the full Google tag snippet (as shown in Install Option 1)

For WordPress sites, the Google Analytics WordPress guide covers the Site Kit plugin and manual insertion. Shopify merchants can follow the Shopify GA4 setup instructions. If your platform is not listed, use the custom HTML approach: copy the entire gtag.js snippet from Admin > Data streams > View tag instructions and paste it into the global header area your builder provides.

Check That Data Is Arriving

After installing the tag, open the Realtime report in Google Analytics. Go to Reports > Realtime. The card shows users active in the last 30 minutes. Visit your website in a new browser tab; once collection has started (Google says this can take up to 30 minutes after setup), your own activity should appear. Anyone with access to the property can view the Realtime report, making it a quick check for the whole team.

Click path: Reports then RealtimeReportsRealtime
Realtime report confirming data is arriving from your website.

For deeper debugging, use DebugView. Unlike Realtime, DebugView can display events over a longer period when you enable debug mode. In DebugView, select your debug device from the DEBUG DEVICE dropdown to filter events from only that device. This report is especially useful while you set up custom events or ecommerce tracking, because it shows event parameters in detail.

Google Tag Assistant at tagassistant.google.com provides another verification layer. Enter your website URL and it lists all detected Google tags. Check the Summary tab: if relevant events appear, your tag is set up correctly. If no events appear, the tag may not be connected to its destination. If the tag is not found at all, check your website’s code and measurement ID. Standard reports can take 24 to 48 hours to process data, but the Realtime and DebugView reports let you confirm collection without waiting for that processing. If you still see no data, review the GA4 DebugView guide for common misconfigurations.

Frequently Asked Questions

Is Google Analytics Free For My Website?

Yes. The standard Google Analytics 4 property is free. For most websites, the free version provides all the reporting and analysis features you need.

How Do I Install Google Analytics?

You install Google Analytics by creating a GA4 property, getting a measurement ID, and placing the Google tag snippet on every page of your site. You can paste the snippet directly into your HTML, deploy it through Google Tag Manager, or enter the measurement ID into your CMS’s native Analytics field.

What Is Replacing Google Analytics?

Google Analytics 4 replaced Universal Analytics.

How To Get Google Analytics 4 GA4 Certification?

Google offers a free Google Analytics Certification through its Skillshop training platform. Check Skillshop for the current course and exam details before you start.

What Is The URL For Google Analytics?

The web interface is at analytics.google.com. The Google tag script is loaded from googletagmanager.com/gtag/js. The Tag Manager console is at tagmanager.google.com, and the Tag Assistant debugging tool is at tagassistant.google.com.

Is The Google Analytics API Free?

The Google Analytics Data API has no usage fee for standard properties. Requests are limited by quotas, which are higher for Analytics 360 properties, so check Google's Data API quota documentation for current limits.