How Do I Add The Google Analytics Code To The Template
Google Analytics is a powerful reporting tool which you can use to understand where your web site traffic is coming from plus it will give you a better understanding about your web site visitors behavior and help you to make improvements at your Joomla site.
Why should you use Google Analytics
- It’s free to use
- Provides you with detailed reports about where your traffic is coming from including demographics, technology used, visitors flow plus much more all of which can be easily accessed via the online reporting tool
- You can get a better understanding of your website visitor behavior patterns. For example which page they most visited, which page did they exit at, how long they spent on a page and lots more
- You can make improvements to your website based on the reports generated by the reporting tool
- Its easy to add the Analytics code to the Joomla template
Step 1 Create a new Google Analytics account
- Visit the Google Analytics site and create a new account
- Once you have created the new account log into the website
- Select the Admin button located in the top right menu
- Click the new account button to create the new account for your website
- Complete all the fields for the account
- Select the create new account button located at the bottom of the form
Step 2 How do I get the Analytics code
- From any Analytics page select the Admin button
- From the account administrator area select the property (account profile name you setup for the website you want to track)
- You will now see a number of tabs, select the tracking info tab as show in the screen shot below
- Open up the Notepad application on your computer
- Copy the code from the analytics page and paste the code into Notepad
- The reason why we advise you to use notepad is because it is a raw editor and will not generate any unwanted, rogue code when you are copying and pasting code.
Step 3: How do add the Analytics code in the Joomla template
All the templates we have released at the website for Joomla 3.3 plus some of the latest templates we have created for Joomla 2.5 allow you to easily add the analytics code via the built-in control panel.
For more information read the how do I update the header and footer code article in the knowledge base
If you are using one of the templates which use version 1 of the control panel please follow the instructions noted below.
- Open the FTP software you have installed on your computer
- Connect to your Joomla site via FTP
- Browse to the /templates/template-name/ directory
- Change the template-name to the name of the template you have downloaded at this website
- Download the index.php file to your computer
- Before making any changes to the index.php file make a backup of the file first on your computer
- Open the index.php file using Notepad and search for closing head tag </head> included in the template index.php file
- Copy and paste the Analytics code just before the closing head tag </head> as shown in the screen shot below
- Save the changes to the index.php file
- Upload the updated index.php file using the FTP software to the /templates/template-name/ directory
You have now successfully included the Google Analytics code in the template.
If you need any help with the above please log into the website and open a support ticket.