A Joomla tutorial for enabling Google Analytics on your website

Last Updated:
Category:
Joomla

Analytics can show you where visitors came from, what they read, how long they stayed, what they searched for, and a heap of other valuable stuff. Knowing those things can provide you with infinite insight into your buyers’ mind and provide countless data-backed optimization opportunities.

If you are using Joomla! in most cases you will need to find a third party plugin to install on your site in order to track page views and unique visitors. But if you are using Gavick templates you don’t have to, all you have to get a Google Analytics Tracking ID from: www.google.com/analytics/.

Google currently uses two different tracking code:

  • Classic Analytics (which we used in our templates/Gavern framework)
    and
  • Universal Analytics BETA.
Use Classic Analytics if you want to use GA from Gavick template

Use Classic Analytics if you want to use Google Analytics from Gavick template

How to add Google Analytics code

When you add a new website URL in Google Analytics, the account is provided with a unique Tracking ID.

Google Analitycs Classic

Fill all fields to get GA Tracking ID

Make sure to use the appropriate Tracking ID or code for each domain. The property ID is a string like UA-200000-53. The first set of numbers (000000, in the example) refers to your account number, and the second set (53, in the example) refers to the specific property number associated with the account.

GA Tracking ID example

GA Tracking ID example

This ID is part of the tracking code that you have to copy and paste into the GK template –> Features (tab) –> Google Analytics codes. By default all Gavick templates have options to add a few identifiers used with Google Analytics scripts (Classic).

ga-code-2

Please remember that you only need to place the tracking code identifier here; so a number such as UA-XXXX-X, not a full script. Once you save the changes basic analytics tracking will be ready to track your website. You have to wait at least hour to check result.

How to add Universal Google Analytics code

Universal Analytics gives you access to improved data processing, new collection methods, and more analysis tools. Unfortunately right now our template frameworks doesn’t allow you to use the modern (but still beta) GA code. You can add the tracking code manually here:

gk_template\layouts\default.php

But remember that the script must be placed at the top of your website page, immediately before the tag. If you’re not comfortable hacking around in your Joomla template file, you can also add Google Analytics code to any template with the use of a plugin.

In the JED in categories: Core Enhancements -> Coding & Scripts Integration -> Custom code in Head you will find few extensions (plugins) which help you insert any javascript code (e.g Google Analytics) to the head of your Joomla 2.5 or Joomla 3.2 page.

Simply install a plugin, insert code and enable (publish).

Using the Custom JS plugin for adding custom Javascript code is a safe method as there is no need to change the code of the template. That way you are free to apply updates, when an update from the creator is available, without worrying if the custom changes are going to be lost. The plugin will load your custom Javascript on every page.

Note: You can only access Google Analytics reports using a valid Google Accounts email address.

How to add Piwik Analytics, Yandex Metrica or GoSquared code

Of course, Google Analytics is without a doubt the most popular web analytics tool out there, but there are useful self-hosted replacement solutions:

  • nfrPiwik (www.nfrtest.de/en/informations/plugins) – this plugin connects your Joomla website with your Piwik Analytics. This plug-in is useful if you are switching templates within your site, the tracking code will be written in the current template file.
  • Yandex Metrica (joomalungma.com/ru/plg/yandexmetrica) – this plug-in allows you to easily add in the asynchronous Яндекс Метрика code into the body of your website.
  • GoSquared (www.gosquared.com/support/articles/564070-joomla-plugin-for-gosquared) – this plugin allows you to easily integrate GoSquared Tracking Code into your Joomla! site without having to change any source code or template files. This enables you to monitor your Joomla! sites’ traffic in real-time with GoSquared, the real-time analytics platform.
A Joomla tutorial for enabling Google Analytics on your website 4.385 (87.50%) 8 votes

This article was first published

Villa Belluci - View our NEW theme
×

Tutorials & tips delivered regularly

Expand your purchase with regular tutorials and tips to making your site better, direct to your email.