How to Add Tags to Google Analytics

Cody Schneider5 min read

Tracking what happens on your website feels complex, but it all starts with something called a "tag." If you're looking to understand your user behavior inside Google Analytics, you’ll first need to get tags installed correctly. This article will show you exactly how to do that, focusing on the two primary methods: using Google Tag Manager and adding the tag directly to your site. We'll also clear up some common confusion around different types of "tags" you'll encounter.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

First, What Exactly is a "Tag" in this Context?

The term "tag" can be a bit confusing because people use it to describe a few different things. Let's quickly break down the key players so you know exactly what you're working with.

  • The Google Tag (gtag.js): This is the foundational piece of code. It's a JavaScript snippet that you place on your website. Its core job is to load Google Analytics (and other Google marketing tools) and start collecting data. Think of it as the main power line running to your website from Google.
  • Google Tag Manager (GTM) Tags: Google Tag Manager is a separate, free tool that acts as a container or management system for your code snippets (tags). Instead of putting the Google Tag directly on your site, you put the GTM code on your site. Then, you use GTM's friendly interface to add, edit, and manage your Google Analytics tag (and tags for Facebook, LinkedIn, etc.) without ever touching your website's code again. GTM is like a circuit breaker box, the main GTM code is the box, and each tag you add inside it is a switch for a specific tool.
  • UTM Tags (or Parameters): These aren't code snippets. They are extra bits of information you add to the end of a URL to track where your visitors are coming from. They help you "tag" your inbound traffic for your campaign reports. For example: ?utm_source=facebook&utm_medium=paid_social. These tell Google Analytics that the visitor who clicked the link came from a paid social post on Facebook.

For this tutorial, we will focus on the first two: installing the foundational Google Tag using Google Tag Manager (the recommended method) and installing it directly on your site.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Method 1: The Easiest & Most Flexible Way - Using Google Tag Manager

We'll start with the best-practice method. Using Google Tag Manager (GTM) might seem like one extra step, but it will save you enormous amounts of time and headaches later. It gives you a central place to manage all your tracking code, add new tracking for specific events like button clicks, and keep your website's code clean.

Before You Start: Setting Up GTM

If you haven’t already, you’ll need to create a free Google Tag Manager account. Here’s the quick setup:

  1. Go to tagmanager.google.com and sign in with your Google account.
  2. Click "Create Account." Give your account a name (usually your company name).
  3. Set up a "Container." This is usually named after your website (e.g., www.mywebsite.com). Select "Web" as your target platform.
  4. Once created, GTM will give you two code snippets. These are the only snippets you'll need to manually add to your website. One goes in the <head> of your HTML, and the other goes just after the opening <body> tag. If you use a platform like WordPress, a plugin like "GTM4WP" or "Insert Headers and Footers" makes this a simple copy-and-paste job.

With that done, you won't need to touch your website's code again. Everything else happens inside the GTM interface.

Step-by-Step: Adding the Google Analytics 4 Tag in GTM

This "tag" is what officially connects GTM to your Google Analytics 4 property so that standard data like page views and sessions can be sent.

  1. Find Your GA4 Measurement ID: First, you need your unique ID from Google Analytics.
  2. Create a New Tag in GTM: Head back to your GTM workspace.
  3. Configure the Tag:
  4. Set Up the Trigger: The trigger tells GTM when to fire your tag.
  5. Save, Preview, and Publish:
GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Tracking Actions: Using GTM to Add Event Tags

The real power of GTM is tracking what users actually do. Once your main GA4 configuration tag is set up, you can create other tags to track specific actions, like form submissions, downloads, or button clicks.

Let's walk through a common example: tracking clicks on a "Contact Us" button.

Example: Creating a "Contact Us Button Click" Event Tag

  1. Create a New Trigger:
  2. Create the Event Tag:
  3. Preview and Publish:

Method 2: Adding the Google Tag Directly to Your Website

If you have a very simple website and don’t plan on adding other marketing tags or complex event tracking, you can add the Google Tag (gtag.js) script directly into your website's code. This is faster for a one-time setup but way less flexible in the long run.

Step-by-Step Guide:

  1. Find your Google Tag Script:
  2. Paste the Script into Your Website's <head> Section:

After saving, Google Analytics will start to receive data. To track specific actions, you'll need to add custom JavaScript snippets accordingly, which is less flexible than GTM.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Final Thoughts

Getting your website properly tagged is the necessary foundation for all data analysis. This article outlined the key concepts behind tagging and guided you through installing your GA4 tag with a management tool like GTM (the pro move for flexibility) or directly onto your site (the simpler, quick-start option). Setting this up correctly ensures you're collecting the clean, reliable data you need to make smart decisions.

Once that data is flowing into Google Analytics, the challenge shifts to making sense of it all. This is where we built Graphed to lend a hand. Instead of digging through hard-to-find reports in GA, you can connect your account and just ask questions in plain English like "compare my organic traffic vs paid traffic for the last quarter" or "which landing pages are performing best?". It turns hours of manual report-building into a simple conversation, so you can focus on getting insights instead of just finding data.

Related Articles