How to Install Google Analytics

Cody Schneider9 min read

Wondering who is visiting your website, where they're coming from, and what they do when they get there? Installing Google Analytics is the first step to turning those questions into answers. This guide provides a clear path to get Google Analytics 4 set up on your site, even if you’ve never touched a line of code.

First Things First: What is Google Analytics 4?

Google Analytics 4 is a free web analytics service that tracks and reports website traffic. Think of it as your website's personal data analyst. It helps you understand your visitors and provides valuable insights into how your site is performing. In July 2023, GA4 officially replaced the older version, Universal Analytics, meaning all new setups will use GA4 from the start.

Why bother setting it up? Because data-driven decisions beat guesswork every time. Here's a quick look at what GA4 helps you do:

  • Understand Your Audience: Learn about your visitors' demographics (age, gender), interests, and what devices they use.
  • Track Traffic Sources: See exactly where your traffic is coming from - whether it's Google search, social media, email campaigns, or direct links.
  • Measure Content Performance: Find out which pages and blog posts are most popular and which ones cause visitors to leave.
  • Monitor Goals and Conversions: Track key user actions, like form submissions, e-book downloads, or product purchases.

Without this data, you're essentially flying blind. With it, you can double down on what works and fix what doesn't.

Step 1: Create Your Google Analytics Account and Property

Before you can add any code to your site, you need to create a GA4 account and a "Property." An account is the highest organizational level, often used for your business. A property resides within an account and represents a specific website or app.

Create the Account

  1. Navigate to the Google Analytics homepage. You’ll need a Google account (like a Gmail address) to get started. If you don't have one, create one first.
  2. Click "Start measuring."
  3. Account setup: Give your account a name. This is usually your business or company name (e.g., "My Awesome Brand").
  4. Account Data Sharing Settings: Review these settings and check the boxes you’re comfortable with. For most users, the default settings are fine. Click "Next."

Create the Property

Now you'll set up your first property, which is your website.

  1. Property name: Enter the name of your website (e.g., "MyAwesomeBrand.com Website").
  2. Reporting time zone and currency: Select your time zone and the currency your business uses. This is important for accurate reporting. Click "Next."
  3. About your business: Google asks for some information about your business, like industry and size. This data is used for benchmarking, giving you insights into how you stack up against others. Answer the questions and click "Next."
  4. Choose your business objectives: Select the goals that are most important to you, like "Generate leads" or "Drive online sales." This helps GA4 customize your reports. Click "Create."
  5. Accept the Google Analytics Terms of Service Agreement for your country.

Step 2: Set Up Your Data Stream

With your account and property created, Google will prompt you to set up a "data stream." This is simply the source of your data. For a website, this is your web data stream.

  1. Choose a platform by clicking "Web."
  2. Set up web stream: Enter your website’s URL (e.g., https://www.myawesomebrand.com) and give the stream a name (the default is usually fine).
  3. Make sure "Enhanced measurement" is turned on. This feature automatically tracks common user interactions like page views, scrolls, and outbound clicks without any extra setup.
  4. Click "Create stream."

After you create the stream, you'll land on a page called "Web stream details." Here, you will find your Measurement ID (It looks like G-XXXXXXXXXX) and your Google Tag. These are the keys to connecting your website to Google Analytics. Keep this page open, you’ll need it for the next step.

Step 3: Install Google Analytics on Your Website

This is where you sync your website with your new GA4 property. There are a few ways to do this, ranging from super simple to a bit more technical. We'll cover the three most common methods.

Method 1: Use a Website Builder Integration or Plugin (The Easiest Way)

Most modern content management systems (CMS) and website builders have built-in integrations or easy-to-use plugins that handle the installation for you. You just need to find the right settings menu and provide your Measurement ID.

For WordPress Websites:

The easiest route is using a plugin. Google's own Site Kit is an excellent option because it integrates Analytics, Search Console, and other Google services in one place.

  1. From your WordPress dashboard, go to Plugins > Add New.
  2. Search for "Site Kit by Google," then install and activate it.
  3. Follow the setup wizard to connect your Google account and select the Analytics property you just created. Site Kit handles the rest automatically.

Alternatively, many other plugins like "GA Google Analytics" and various theme settings panels just ask for your GA4 Measurement ID (G-XXXXXXXXXX). Simply copy it from your GA4 data stream details and paste it into the designated field.

For Shopify Websites:

Shopify has made this process straightforward.

  1. From your Shopify admin, go to Online Store > Preferences.
  2. Scroll down to the "Google Analytics" section.
  3. Click "Manage pixel here" and follow the prompts to add the Google channel app if you haven't already.
  4. Connect your Google account and select your GA4 Measurement ID from the dropdown list.

For Squarespace Websites:

  1. In your Squarespace account, go to Settings > Advanced > External API Keys.
  2. In the "Google Analytics" field, paste your GA4 Measurement ID (the one starting with "G-").
  3. Click "Save." That’s it!

Method 2: Use Google Tag Manager (The Most Powerful Way)

Google Tag Manager (GTM) is a free tool that acts as a middleman, allowing you to manage and deploy marketing tags (like your Google Analytics tag) on your website without having to edit the code. It has a slight learning curve, but it's the recommended method for anyone serious about digital marketing and analytics.

  1. Create a GTM Account: Go to the Google Tag Manager website, create an account for your business, and set up a container for your website.
  2. Install GTM on Your Site: GTM will give you two small code snippets. You need to add these to the <head> and <body> of every page on your site. This is a one-time setup, many plugins (like GTM4WP for WordPress) can do this easily for you.
  3. Create a GA4 Tag in GTM: Inside your GTM container, go to Tags > New.
  4. Set Up a Trigger: A trigger tells your tag when to fire. For basic pageview tracking, click Triggering and choose "Initialization - All Pages" or "All Pages." This ensures GA collects data on every page load.
  5. Save and Publish: Save your new tag. Then click the "Submit" and "Publish" buttons in the top right to make your changes live.

Once GTM is set up, you never have to touch your website's code again to add other tracking scripts like the Facebook Pixel or LinkedIn Insight Tag.

Method 3: Manually Add the Google Tag (The Direct Way)

This method involves editing your website's source code directly. You should only use this method if you're comfortable editing HTML and have a way to back up your website first in case something goes wrong.

  1. Find Your Google Tag: In your Google Analytics account, go back to your "Web stream details" page (Admin > Data Streams > Your Web Stream). Under "Installation instructions," you'll see your global site tag, which is a block of JavaScript code starting with <!-- Google tag (gtag.js) -->.
  2. Copy the Code Snippet: Copy the entire block of code.
  3. Paste it on Your Website: You need to paste this code snippet immediately after the opening <head> tag on every single page of your site. If your website uses a theme with a master template file (like header.php in a classic WordPress theme), you can add it there once, and it will apply to all pages.
<!DOCTYPE html>
<html>
<head>
  <!-- Google tag (gtag.js) -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
  <script>
    window.dataLayer = window.dataLayer || [],
    function gtag(){dataLayer.push(arguments),}
    gtag('js', new Date()),

    gtag('config', 'G-XXXXXXXXXX'),
  </script>
  <!-- Other stuff in your head tag, like your title, meta description, etc. -->
</head>
<body>
  ...
</body>
</html>

Step 4: Verify That Your Installation is Working

So how do you know if it's actually working? The easiest way is to use the Realtime report in Google Analytics.

  1. Keep your Google Analytics account open in one browser tab.
  2. Open your website in another browser tab (or on your phone) and click around a few pages.
  3. Go back to Google Analytics and navigate to Reports > Realtime.
  4. Within a minute or so, you should see yourself as an active user. You'll see a blue dot on the map in your location and see the pages you've visited show up in the "Views by Page title" card.

If you see activity, congratulations - you've successfully installed Google Analytics! Keep in mind that it can take 24-48 hours for data to fully populate in all the standard reports, but the Realtime report is your proof of a successful setup.

Final Thoughts

Setting up Google Analytics is a foundational step in building a successful online presence. You've just installed a powerful tool that will help you move from making guesses about your website to making decisions based on real user behavior.

Once you start collecting data, the next step is making sense of it all. We built Graphed to cut through the complexity of tools like GA4. With our platform, you simply connect your Google Analytics account, ask questions in plain English like "Which blog posts brought in the most new users last month?", and get instant dashboards and answers. It helps you turn your new data into actionable insights without the steep learning curve.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.