What Does a Google Analytics Tag Look Like?

Cody Schneider8 min read

A Google Analytics tag is the small but mighty snippet of code that connects your website to Google's powerful analytics platform. It’s what lets you understand who is visiting your site, where they’re coming from, and what they’re doing. This article will show you what the Google Analytics tag looks like today, explain its older counterpart, and guide you on where to find and place it on your site.

What Exactly Is a Google Analytics Tag?

At its core, the Google Analytics tag is a piece of JavaScript code that you install on your website. Think of it as a digital messenger. Every time someone visits a page on your site, this code activates, gathers anonymous information about the visitor and their session, and sends that package of data back to Google Analytics for processing.

This "package" of data includes information like:

  • Which page the user is viewing.
  • How they arrived on your site (e.g., from Google search, a Facebook link, or by typing in your URL).
  • The type of device they're using (desktop, tablet, or mobile).
  • Their general geographic location (city, country).
  • How long they spend on a page and buttons they click.

Without this tag, your Google Analytics account remains empty. It's the critical link that gathers the raw materials - your website data - that you can later turn into valuable business insights about your audience and marketing effectiveness.

The Modern Google Tag (gtag.js): The One You’ll Use Today

If you're setting up Google Analytics now, you’ll be working with the Google tag, also known as gtag.js. This is the current, unified tracking script that serves not only Google Analytics 4 but also other services like Google Ads. It’s designed to be a single, streamlined tag for all of your Google tracking needs.

Here’s what the current Google tag looks like:

<!-- 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>

Breaking Down the Code

You don't need to be a developer to understand the basics of what's happening here:

  • <!-- Google tag (gtag.js) -->: This is simply an HTML comment. It doesn’t do anything functional, it’s just there as a label to help humans identify the code block.
  • <script async src="..."></script>: This line loads the main gtag.js library from Google's servers. The async attribute is important - it tells the browser to load this script in the background without slowing down the rendering of your website's content.
  • window.dataLayer = window.dataLayer || [],: This initializes something called the "data layer." Think of it as an empty bucket ready to catch data about interactions on your site. The gtag.js script sends information here.
  • function gtag(){dataLayer.push(arguments),}: This defines the core gtag function that is used to send commands and data to the data layer.
  • gtag('js', new Date()),: This command initializes the tracking with a timestamp.
  • gtag('config', 'G-XXXXXXXXXX'),: This is the most critical line. It configures the tag to send data specifically to your Google Analytics property, identified by the unique Measurement ID (which starts with "G-"). This ID is what links your website's code to your GA4 account.

How to Find Your Google Analytics 4 Tag

Ready to find this snippet in your own account? Getting your personalized Google tag only takes a minute. Here’s the step-by-step process in GA4.

Step 1: Go to the Admin Panel

Log in to your Google Analytics account. In the bottom-left corner, click on the gear icon labeled Admin.

Step 2: Choose Your Property and Access Data Streams

You'll see three columns: Account, Property, and View (if you still have a Universal Analytics property). In the Property column, find and click on Data Streams. This is where GA4 manages the different sources feeding it data, such as your website or app.

Step 3: Select Your Web Data Stream

A list of your data streams will appear. Click on the one that corresponds to your website. Most businesses will only have one web stream listed here.

Step 4: View Tag Instructions

On the next screen, you’ll see details about your data stream. Look for the section titled "Google tag" and click on View tag instructions.

Step 5: Copy Your Tag

A new page will load showing your tag information. Make sure you are on the Install manually tab. There you will find the complete gtag.js script we discussed above, loaded with your unique Measurement ID. Just click the copy icon to get the full snippet.

What About the Old Universal Analytics Tag (analytics.js)?

Google officially retired Universal Analytics (UA) on July 1, 2023. However, millions of websites were built using its tracking code, so you might still come across it. Recognizing this older tag is crucial so you can replace it with the new GA4 tag and ensure your data collection continues.

Here is what the legacy Universal Analytics tag (analytics.js) looks like:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r,i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date(),a=s.createElement(o),
m=s.getElementsByTagName(o)[0],a.async=1,a.src=g,m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'),

ga('create', 'UA-XXXXXXXX-X', 'auto'),
ga('send', 'pageview'),
</script>

The biggest giveaway is the Tracking ID that starts with UA- instead of the modern G- Measurement ID. This code used a different library (analytics.js) and a different data model based on sessions and pageviews. Today's gtag.js is built around a more flexible, event-based model that tracks specific user actions, not just page loads.

If you see UA- code on your site, it’s a clear sign you need to upgrade to GA4.

Where to Install the Google Analytics Tag on Your Website

No matter which installation method you choose, Google’s instruction is always the same: place the Google tag in the <head> section of your HTML, right after the opening <head> tag on every page you want to track.

Why the <head>? Placing it here ensures the script loads as early as possible during the page loading process. This maximizes your chances of capturing data from visitors who might click away before the entire page has finished rendering.

There are three common ways to do this:

1. Manual Installation

This involves directly editing your website’s theme files. For a WordPress site, this could mean editing the header.php file and pasting the code in. Warning: This method is best for those comfortable with code. Always back up your site and use a child theme to avoid your changes being overwritten during a theme update.

2. Using a Plugin or Built-in Feature

Most modern website platforms offer easier ways to add scripts. For example, in WordPress, plugins like "WPCode – Insert Headers and Footers" allow you to simply paste your Google tag into a field without touching any code. Platforms like Shopify or Squarespace often have a dedicated field in their settings specifically for your Google Measurement ID.

3. Google Tag Manager (GTM)

This is the industry-standard method and the most scalable solution. Google Tag Manager acts as a container for all of your tracking scripts (not just GA). Instead of adding multiple scripts to your site’s code for different tools (Facebook Pixel, Google Ads, etc.), you add the GTM container code once. Then, you manage all of your tags from the user-friendly GTM interface. It keeps your site code clean and gives you immense flexibility.

How to Check if Your Tag is Working

After installing the tag, you’ll want to confirm it’s firing correctly. Here are a few simple verification methods:

  • The Realtime Report: The easiest way. Open your website in a new browser window. In your GA4 account, navigate to Reports > Realtime. If the tag is working, you should see your own visit pop up in the "Users in Last 30 Minutes" card within a minute or two.
  • Browser Developer Tools: Right-click on your site, select "Inspect," and go to the "Network" tab. Refresh the page. In the filter box, type collect. You should see requests being sent to google-analytics.com/g/collect..., which confirms that data hits are being sent.
  • Google Tag Assistant: This is a free legacy Chrome extension from Google. You can install it, navigate to your site, and enable it. It will show you exactly which Google tags are detected on the page and if they are firing correctly.

Final Thoughts

Understanding what your Google Analytics tag looks like and where to find it is the gateway to data-driven decision-making. Whether you're working with the modern gtag.js for GA4 or replacing an old Universal Analytics snippet, properly installing this code in your site's <head> unlocks the ability to see how users interact with your content.

Once your tag is installed and data starts flowing in, the focus shifts to making sense of it all. This is where many teams find themselves logging into complex interfaces and trying to stitch reports together. With Graphed, we help you skip that entire step. You can connect your marketing and sales data sources (like Google Analytics) and simply ask for the reports you need in plain English. Instead of building charts manually, just ask, "Show me weekly traffic from organic search versus paid ads," and get an instant, real-time dashboard that answers your question.

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.