How to Install Google Analytics in Joomla 3

Cody Schneider8 min read

Getting Google Analytics set up on your Joomla 3 site is one of the most important first steps for understanding your audience. This simple tracking tool gives you a powerful look into who your visitors are, how they find you, and what content they interact with most. This guide will walk you through the entire process, covering the easiest plugin-based method for beginners and the manual code installation for those who prefer more control.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Before You Start: Get Your Google Analytics Tracking ID

No matter which installation method you choose, you first need to get your unique tracking code snippet from Google Analytics. This is how Google identifies your website and funnels data into the correct account. If you already have this, you can skip to the next section.

Today, the standard is Google Analytics 4, which uses a "Measurement ID." It looks something like G-XXXXXXXXXX. Here’s how to find it.

Step 1: Create a Google Analytics Property

If you don’t have a Google Analytics account yet, create one first. Then, follow these steps to set up a new property for your Joomla site:

  • Log in to your Google Analytics account.
  • Click on Admin (the gear icon) in the bottom-left corner.
  • In the Property column, click Create Property.
  • Enter a name for your property (e.g., "My Joomla Site") and set your time zone and currency. Click Next.
  • Provide your business information and click Create.

Step 2: Set Up a Data Stream

Once your property is created, Google will prompt you to set up a "data stream." This is the source of the data - in this case, your website.

  • Choose Web as your platform.
  • Enter your website's URL (e.g., https://www.yourjoomlasite.com) and give the stream a name.
  • Click Create stream.
GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Step 3: Find Your Measurement ID and Global Site Tag

After creating the data stream, you'll be taken to the "Web stream details" page. This is where you'll find the information you need.

Look for the Measurement ID in the top-right corner. It will be in the format G-XXXXXXXXXX. You'll need this ID for the plugin method.

For the manual method, you'll need the full tracking code. Click on View tag instructions under the "Global site tag (gtag.js)" section, then select the "Install manually" tab. You'll see a snippet of JavaScript code. This is what you'll need to copy for the manual installation. Keep this page open in a tab for easy access.

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-YOUR_MEASUREMENT_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [],
  function gtag(){dataLayer.push(arguments),}
  gtag('js', new Date()),

  gtag('config', 'G-YOUR_MEASUREMENT_ID'),
</script>

Now that you have your code, you're ready to add it to Joomla.

Two Ways to Install Google Analytics in Joomla

You have two primary options for integrating Google Analytics with your Joomla 3 site. There's no right or wrong answer here, it depends on your comfort level with code.

  • Method 1: Using a Joomla Extension (Recommended for Beginners): This is the simplest and safest way. You install a plugin, paste your Measurement ID into a field, and you're done. It requires no coding and minimizes the risk of breaking your site's template.
  • Method 2: Manually Editing Your Template: This method involves adding the tracking code directly into your template's main file. It gives you more control and avoids an extra extension but requires caution, as an error could cause display issues.

We'll walk through both methods step-by-step.

Method 1: The Easy Way with a Joomla Extension

For most users, an extension is the best way to get Google Analytics up and running. There are many great, lightweight extensions available. One popular and simple option is "Asynchronous Google Analytics," which is free and well-supported.

Step 1: Find and Install the Extension

  1. Navigate to the official Joomla Extensions Directory (JED) and search for a Google Analytics plugin. We'll use "Asynchronous Google Analytics" as our example, but the process is similar for others.
  2. Download the extension's package file (usually a .zip file) to your computer.
  3. Log in to your Joomla administrator dashboard.
  4. Go to Extensions → Manage → Install.
  5. Drag and drop the .zip file you downloaded into the upload area, or use the "Or browse for file" button to select it.
  6. You should see a message confirming the successful installation.
GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

Step 2: Enable and Configure the Plugin

Now that the extension is installed, you just need to activate it and add your Measurement ID.

  1. In your Joomla admin dashboard, go to Extensions → Plugins.
  2. Use the search bar to find the plugin you just installed. A search for "google" or "analytics" should locate it quickly.
  3. The plugin will likely have a red 'x' next to it, indicating it's disabled. Click the red 'x' to enable it. It should turn into a green checkmark.
  4. Click on the plugin's name to open its configuration settings.
  5. You'll see a field labeled something like "Google Analytics Tracking ID" or "UA/Measurement ID."
  6. Paste your GA4 Measurement ID (the one that starts with "G-") into this field.
  7. Review the other options. Many plugins allow you to exclude tracking for administrators so your own visits don't skew the data. This is typically enabled by default and is highly recommended.
  8. Click Save & Close.

That's it! The plugin will now automatically insert the correct Google Analytics tracking code onto every page of your Joomla website.

Method 2: Manually Adding Code to Your Template

If you prefer to keep your extension list minimal or want complete control, you can add the tracking snippet directly to your template's code. Important: Always create a backup of your site before editing core template files. A small mistake can break your site's layout.

Step 1: Locate Your Default Template File

The code needs to be placed in the main template file that loads on every page. In Joomla, this file is typically index.php.

  1. In your Joomla admin dashboard, navigate to Extensions → Templates → Templates. (Yes, you click "Templates" twice).
  2. On this screen, you'll see a list of installed templates. Locate the one with a star next to it under the "Default" column. This is your active site template.
  3. Click on the template's name (e.g., "protostar Details and Files").

Step 2: Add the Google Analytics Snippet

This will open the template editor, showing a list of files on the left side.

  1. From the file list, click on index.php. This will load the file's code into the main editor window.
  2. The Google Analytics tracking code should be placed just before the closing </head> tag. Scroll through the code until you find that tag. It's usually near the top of the file.
  3. Go back to your Google Analytics tab and copy the entire Global Site Tag (gtag.js) snippet we located earlier.
<!-- Global Site Tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-YOUR_MEASUREMENT_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [],
  function gtag(){dataLayer.push(arguments),}
  gtag('js', new Date()),

  gtag('config', 'G-YOUR_MEASUREMENT_ID'),
</script>
  1. Paste the full snippet onto a new line right above the </head> tag in the index.php file.
  2. Double-check that you've pasted the code correctly and haven't accidentally deleted any other code.
  3. Click the Save or Save & Close button at the top of the page.

Your tracking code is now live. One downside to this method is that if you update your Joomla template, your customizations to the index.php file might be overwritten. Using a child template or template overrides is the advanced way to prevent this, but for a simple code snippet, re-adding it after an update is also a manageable solution.

GraphedGraphed

Still Building Reports Manually?

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

Watch Graphed demo video

How to Verify Your Installation is Working

You’ve done the work, now it's time to make sure data is actually being collected. The easiest way to confirm this is by using the Realtime report in Google Analytics.

  1. Open your Google Analytics account.
  2. In the left-hand navigation, go to Reports → Realtime.
  3. Keep this screen open. In a new browser window or tab, visit your Joomla website. Make sure you're not logged in as a Joomla administrator if you've configured your plugin to exclude admin traffic.
  4. Switch back to your Realtime report tab. Within a minute or two, you should see your own visit pop up. The "Users in last 30 minutes" count should change to "1," and you'll often see the city you're located in appear on the map.

If you see your visit, congratulations - your Google Analytics integration is a success! If nothing appears after a few minutes, clear your browser cache and your Joomla site cache, then try again. If it still doesn't work, re-check that your Measurement ID was pasted correctly or that the manual code snippet is in the correct place.

Final Thoughts

In this post, you learned two solid methods for getting Google Analytics up and running on your Joomla 3 site. Whether you used a simple extension for a quick and safe setup or opted to add the code manually for more direct control, you're now equipped to start collecting valuable data about your visitors.

Getting the data is just the first step. The real challenge is turning that sea of numbers into actionable insights. Instead of spending hours learning complex dashboarding tools, we built Graphed to simplify the process. By connecting your Google Analytics account, you can use plain English to ask questions and instantly generate dashboards, helping you see which content performs best and how your audience behaves without ever getting bogged down in reporting.

Related Articles