Site5 - Built For Designers & Developers MENU
Home  ›  Stats, Analytics, and Logs  ›  Google Analytics  ›  Logs: Add a Google Analytic tracking code to your Joomla website

Logs: Add a Google Analytic tracking code to your Joomla website


In this article, we will show you how to add a Google Analytic tracking code to your Joomla website.

1) Log into the Joomla administration panel

2) Click the Template Manager link

3) Click the Templates tab

4) Locate the template your site is using, then click on its title

5) Click the Edit main page template link

6) At the bottom of the code, locate the </body> tag and insert your tracking code above it

7) Click the Save & Close button

That’s it! You should start to see tracking results from this site within 24 hours on the Google Analytics panel

Still have a question? Or need help?
If you need technical support with your account, please email us or chat live with a representative.


  • We had a site made and now we must manage and handled it…we are all new to Joomla…

    • Hi Kate,

      Joomla is actually pretty straightforward, though can be a little daunting. They actually have a large community support group at, and we can certainly try to help with any specific questions you may have, as well, if you contact our support team.

  • Thanks for the help.

  • I am using joomla 3 and after clicking the template name it doesn’t show the “main page template” link. Please Help me

    My website is :

    • Hello Akash,

      You should still have the option to edit the template, though it may be named differently. Alternatively, you can use FTP to do this, by downloading the index.php file that is in the templates/templatename folder (where templatename is the actual name of your template). Download the index.php file locally, then edit it in notepad. Add the analytics code right before the /body tag, and save the file.

      Then, simply upload the index.php file to the same location, overwriting the one that is already there. It may be a good idea to have a backup of the unmodified index.php file saved, as well, just in case :)

      • Thank You for your help. But after wasting my 1 month to setup my website using joomla, i came to know wordpress is too much easy and compatible to use.

        BTW again Thanks For Your Help.

        You can check my website again and see how optimized it is now, since it is still under construction. But i am very Happy that scripts like wordpress are here to help people like me.

        Take a look :

  • I do not see the tag – we are using yoo cloud. Does that have a body tag?

    Can I insert the tracking code at the bottom of of the page?

    Do I than go and insert it on every page of the website? If so, where do I find those pages?

    • Hello Elizabeth,

      Every theme should have the body tag, as that is pretty standard for code on a website :) Are you editing the index.php file for the theme?

      • Yes, I was editing the index.php file – thanks. For the template Yoo_Cloud I’m only getting the index page.

        Should I try “Edit print view template”?

        • Hello Elizabeth,

          That is strange. Can you open a ticket with our support team, via BackStage, so we can take a look at this for you?

          • Sure, how do I open a ticket?

            • Hi Elizabeth,

              If you login to BackStage, you should see a Support link there. You can open the ticket from that, and we’ll be more than happy to help :)

              • James – thanks, got it!

  • How to remove index.php from url in joomla 2.5

    • Hi there! That would be something you should be able to edit in the admin settings, or by using .htaccess

      If you would like, we can take a look at this for you, but you may want to open a ticket in the helpdesk to get it done properly. You can open the ticket from within BackStage, using the support links there.

    • the same problem with me, i also want to solve this issue with my url

  • Thanks for the advice – I have just paste the code into the template page as suggested. Currently I am not live with the website just yet and so cant check if it is working. Does pasting the code in once to the template page still track every page without me having to paste in to every page of my website?

    • Hi Charlotte,

      Yes, that should track every page, as it is in the template file, which is used universally by Joomla.

  • Does Joomla have any plugins that can be installed to add analytics tracking? I am really confused how all this works.

    • Hello Keith,

      I can’t say for certain, as we are not Joomla’s developers, nor do we develop modules for the software. I am sure there are some plugins out there, however, that will do this for you. I would recommend the Joomla forums to get started finding one.

  • These instruction were really simple and easy to follow. I know there are plugins, but this method works well. Thanks for sharing!

  • i am using custom temple in joomla….

    • Hello Salman,

      These steps should still apply. You would just have to work with yoru custom template rather than a pre-built one.

  • Hello, i just placed the google analytics code in to my joomla website by opening index.php in template page but its not effecting to all the page. what is the problem is there any solutions? Please help me out.
    Thanks in advance.

    • Hello Vishnu,

      That is strange, and may be dependent on the template. Have you tested this in another template, to confirm?

  • thnx really appreciated

  • Thanks for your Great Post. I will consider all these things for my new blog. Thanks Again!

  • I do not have a “main page” link in my template.
    Is this the same as index.php? There are no body tags in that file either.

    • Hi Becky,

      Yes, the main page would be index.php. You would place the code anywhere, really – if there are no body tags, then simply place the code after the

  • m using histats but it’s not helpful for me at all

    • Hi Sara,

      Not a problem at all, Google Analytics should help you if histats isn’t. If you notice any problems getting these set up, please feel free to contact our support team by opening a ticket through your backstage panel and we’ll be glad to take a look!

  • Another approach:

    1) Extensions –> Modules –> New –> Custom HTML
    2) Toggle editor to no formatted text and paste your Google analytics code within ,
    3) select any template position (any position will do since the script does not affect the DOM, but prefer one at the bottom of the template),
    4) make sure at “Menu Assignment” that the module is assigned on all pages (it is by default), and
    5) Save.

    With this approach the code is not lost if the template gets upgraded.
    The same if you change template where the new template has different position names. Just change the module’s position to one of the new template.

  • Nice work here. Thank you.

Money Back Guarantees