How to use Google Analytics with Joomla

This article discusses several ways you can use Google Analytics with a Joomla site.

Using Google Analytics with Joomla

Google Analytics provides detailed statistics about visitor traffic to your site. To use Google Analytics with Joomla (or with any other type of site), you must first sign up for a Google Analytics account at http://www.google.com/analytics and obtain a unique Tracking ID.

After you have set up a Google Analytics account and have the Tracking ID for your site, you can configure it for Joomla. There are two ways to do this:

  • Use a Joomla extension.
  • Edit the Joomla template.
Method #1: Use an extension

There are numerous extensions that enable you to configure Google Analytics for a Joomla site, and they all function in essentially the same way—all you have to do is specify your Tracking ID, and the extension takes care of the rest.

Here are some popular Google Analytics extensions for Joomla:

To view a complete list of Google Analytics extensions on the official Joomla site, please visit http://extensions.joomla.org.
Method #2: Edit the template

Extensions are convenient, but they also carry processing overhead with them that can affect site performance. If you prefer not to use an extension, you can edit the Joomla template directly to enable Google Analytics for your site.

One disadvantage of editing templates directly is that if Joomla is updated, the modifications may be overwritten. For information about how to avoid this scenario, please visit https://docs.joomla.org/J3.x:Modifying_a_Joomla!_Template.

To enable Google Analytics by editing the template, follow these steps:

  1. Log in to your Google Analytics account, click Admin, click Tracking Info, and then click Tracking Code. Copy the entire text in the tracking code box, including the starting <script> tag and the ending </script> tag.
  2. Log in to Joomla as the administrator.
  3. On the top menu bar, click Extensions, click Templates, and then click Templates.
  4. Click the name of the template you want to modify.
  5. Select the file in the template that you want to modify, and then paste the Tracking ID code snippet from Google Analytics that you obtained in step 1.
    Make sure you include the starting <script> tag and the ending </script> tag.
  6. Save your changes to the template file, and then reload your site in a web browser. Examine the page source code to verify that the Google Analytics code is loaded.
    It can take up to 24 hours for Google Analytics to change its status from Tracking Not Installed to Receiving Data.

More Information

For more information about Google Analytics, please visit http://www.google.com/analytics.

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.