How to Add Google Analytics to Landing Page

Cody Schneider10 min read

Building a great landing page is only half the battle, if you aren’t tracking its performance, you're flying blind. Installing Google Analytics is the first step to understanding who your visitors are, where they came from, and what they do after they arrive. This tutorial will give you a clear, A-to-Z guide on how to add Google Analytics to your landing page so you can stop guessing and start making data-driven decisions that improve your results.

Why Bother Tracking Your Landing Page?

Setting up tracking might feel like a technical chore, but the payoff is enormous. Once Google Analytics is connected, you unlock crucial insights that directly impact your marketing ROI. It’s the difference between hoping a campaign works and knowing why it does (or doesn't).

Here are the key benefits you get right away:

  • Understand Traffic Sources: See exactly which channels are sending visitors to your page. Is it your Facebook ad, a guest post, or a specific email campaign? Knowing this tells you where to double down on your efforts and budget.
  • Analyze User Behavior: Learn how people interact with your page. Are they leaving immediately (a high bounce rate)? How long do they stay? This data helps you spot problems with messaging, design, or user experience.
  • Track Conversions: This is the most important part. You can measure how many people fill out your form, click "Buy Now," or download your e-book. By defining these actions as conversions, you can directly attribute clicks and successes to your marketing efforts.
  • Optimize Your Page: The data you collect is your roadmap for improvement. If you see that 90% of traffic comes from mobile but your page loads slowly on phones, you’ve just found a massive opportunity to increase conversions.

First, Find Your Google Analytics Measurement ID

Before you can install any tracking, you need to find the unique identifier for your Google Analytics property. This is your "Measurement ID," and it tells Google where to send the tracking data. Getting this is the essential first step.

If you haven't created a Google Analytics account yet, you'll need to do that first. Be sure to create a Google Analytics 4 property, as this is the latest version. Once you're set up, follow these steps:

  1. Log into your Google Analytics account.
  2. Click the Admin cog icon in the bottom-left corner of the page.
  3. In the 'Property' column (the middle one), click on Data Streams.
  4. Click on the Web data stream that corresponds to your website. If you just set up your property, you will likely only have one.
  5. On the next screen, you'll see your MEASUREMENT ID in the top-right corner. It will look like G-XXXXXXXXXX.

Copy this ID to your clipboard. You'll need it in a moment.

Two Methods for Adding Google Analytics to Your Landing Page

There are two primary ways to get Google Analytics running on your landing page: installing the tracking code directly into the page’s code, or using Google Tag Manager (GTM).

  • Manual Installation: This is the quickest method for a single page and is good if you just need basic pageview tracking.
  • Google Tag Manager: This is the most robust and recommended method. It keeps your page’s code clean and makes it much easier to add other marketing tags (like a Facebook Pixel or LinkedIn Insight Tag) down the road without ever touching the code again. We'll cover both.

Method 1: Manual Installation (The Global Site Tag)

This approach involves adding the Google Analytics JavaScript snippet, called the global site tag (gtag.js), directly into your landing page's HTML file. Many landing page builders like Instapage, Unbounce, or Leadpages have simplified this by giving you a special section to paste this kind of code.

Step 1: Get the Global Site Tag Snippet

In the same "Data Streams" section where you found your Measurement ID, look for the "View tag instructions" button at the bottom of the page. Click it, then select the "Install manually" tab. Google will provide you with a block of code that looks something like this:

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

Notice that your unique Measurement ID (G-XXXXXXXXXX) is already included. Just hit the copy button to grab the entire snippet.

Step 2: Add the Code to Your Landing Page

This code needs to be placed within the <head> section of your landing page’s HTML. Exactly how you do this depends on the platform you're using:

  • If you're using a custom-coded HTML page: Open the HTML file in a text editor and paste the copied snippet on a new line right before the closing </head> tag. Save the file and upload it to your server.
  • If you're using a landing page builder (like Unbounce or Leadpages): You almost never need to edit the raw HTML. Instead, look for a section in your page builder’s settings called "Scripts," "Custom Code," or "Header & Footer Scripts." There is usually a box designated for code that needs to go in the header. Paste your entire Google Analytics snippet there.
  • If you're using WordPress: While you could edit your theme files (not recommended), the easiest way is to use a plugin like "Insert Headers and Footers" or use your theme’s built-in functionality for adding code snippets, often found in the theme customizer.

Once you’ve saved and published your changes, Google Analytics tracking will be active on your page.

Method 2: Using Google Tag Manager (The Recommended Approach)

Google Tag Manager (GTM) acts as a container for all your marketing and analytics tags. Instead of adding multiple code snippets to your site for different tools, you add the GTM snippet once. Then, you manage all your other tags (including Google Analytics) from the easy-to-use GTM dashboard. It's the clean, scalable, and professional way to handle tracking.

Step 1: Set Up and Install Google Tag Manager

If you don't have a GTM account, head to Google Tag Manager and create one. After you create a container for your website, GTM will give you two code snippets. Just like the manual install, one goes in the <head> and the other high up in the <body> of your page. Many platforms skip this entirely and just ask for your GTM Container ID (e.g., GTM-XXXXXXX).

Step 2: Create a New Tag in GTM

Once GTM is on your site, log into your container and follow these clicks:

  1. Navigate to Tags on the left-side menu and click New.
  2. Give your tag a descriptive name, like "GA4 - Base Configuration".
  3. Click inside the Tag Configuration box to choose a tag type. Select Google Analytics: GA4 Configuration from the list.

Step 3: Configure the GA4 Tag

This is where you connect GTM to GA4. In the Measurement ID field, paste the G-XXXXXXXXXX ID you copied from your Google Analytics data stream. For a basic setup, you can leave all other settings as their defaults and just let the tag send a pageview event when it loads.

Step 4: Add a Trigger

A "trigger" tells your tag when to fire. For GA4 page tracking, you want it to fire on every page that it's on.

  1. Click inside the Triggering box at the bottom.
  2. Select the All Pages trigger. This is a default trigger already built into GTM that fires on every page view.
  3. Click Save to finish creating your tag. You're almost done!

Step 5: Preview and Publish Your Container

One of GTM’s best features is its "Preview" mode, which lets you test your changes before they go live.

  1. In the top right of your GTM dashboard, click Preview.
  2. Enter your landing page's URL and click Connect. A new browser tab will open with your landing page, and you'll see a small Tag Assistant overlay.
  3. In your original GTM tab (the Tag Assistant console), you should see your tag "GA4 - Base Configuration" in the list of "Tags Fired." This confirms it's working properly!
  4. Once you've confirmed it works, close the Preview mode. Click the blue Submit button in GTM, give your changes a version name (like "Added GA4 Tag"), and hit Publish. That's it!

How to Verify That Google Analytics Is Working

After installing your tracking code, you need to confirm that it's actually collecting data. There's nothing worse than thinking you're tracking performance for a week, only to find you were collecting nothing. Here are two quick ways to check:

  • The Realtime Report: Go to your Google Analytics account and navigate to Reports > Realtime. Now, open your landing page in a different web browser or on your phone. Within a minute or so, you should see yourself appear as a new visitor on the Realtime map and in the report cards. If you see activity, it's working.
  • The Tag Assistant Companion Extension: This Google Chrome extension is a must-have if you use GTM. When you visit your landing page, the extension’s icon will light up and tell you which tags (including Google Analytics) were found and fired successfully on the page.

Next Steps: Tracking Landing Page Conversions

Now that you’re tracking page views, the key to unlocking its potential is tracking conversions. A conversion is any key action a user takes on your page that aligns with your goal, like submitting a form, clicking on a link in the navigation menu, clicking "contact us," or clicking on a CTA button. Here are popular ways to track them inside Google Analytics to achieve your main goal:

  • Thank You Page Tracking: The simplest conversion tracking method. Redirect users who fill out your form to a separate "thank you" page (e.g., yourwebsite.com/thank-you). Then, in GA4, you can create a new conversion event that is triggered every time someone visits that specific page URL.
  • Button Click Tracking: What if your conversion isn’t a form fill, but a click on a "Request Demo" or "Download Case Study" button? Using Google Tag Manager, you can set up triggers that listen for specific button clicks and fire a custom event tag to Google Analytics, which you can then mark as an excellent conversion rate for campaigns on page conversion reporting.

Final Thoughts

Getting Google Analytics configured on your landing page isn't just a technical task, it's the critical first step to turning traffic into measurable results. By following these steps, you have moved beyond relying on best practices, from 'hope-based' marketing to a data-driven strategy, and are now equipped to make decisions by capturing every visitor's web analytics.

Once you start collecting that valuable user engagement data in your Analytics Reports, analyzing campaign data becomes easier. We created Graphed to streamline this process. Since we connect directly to Google Analytics, you can use our platform to ask direct queries about valuable information such as "Show me the top converting campaign traffic report from last week" or "Show me every user who clicked from outside the United States with new session data." Get your answers with instant visuals ready for the perfect landing page reports without leaving your browser's tabs.

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.