Are you confused since you don’t know how to add Google Analytics to Cassiopeia Joomla 4? Don’t worry about that. In the blog today, we will show you 2 methods to do that. Therefore, let’s have a look, choose the way you want, and follow the few simple steps to add code now!
Why do you need to add Google Analytics to Cassiopeia Joomla 4?
As you know, Google Analytics is a web analytics tool that Google offers you, supporting you to see the vital analytics and data related to your site traffic. There are a lot of benefits that Google Analytics brings you, including:
- Showcase and analyze the site traffic with clear and detailed data.
- Provide the information about visitors.
- Identify the top content of your site.
- Identify which page is the most attractive.
- Offer the information about the bounce rate
- And much more…
No matter what CMS you are using, adding Google Analytics code to your site is really necessary. If you are developing a Joomla website and have an intention to use Google Analytics, this blog is the best option for you. Now, don’t hesitate to explore how to Add Google Analytics to Cassiopeia Joomla 4.
Add Google Analytics to Cassiopeia Joomla 4 step-by-step
In order to add Google Analytics to Cassiopeia Joomla 4 website, you need to generate an account on the Google website as well as create a website tracking code first.
Once you generate the analytics code, simply copy the code to insert to your site in the next steps. Here is an example of a Google Analytics code.
Accessing the index.php file to add code directly
The first way to add Google Analytics to Cassiopeia Joomla 4 is adding this code to the index.php file. However, this way is not recommended because the code will be lost when Cassiopeia is updated. The second method with the KickstartCassiopeia module will be safer.
In case you still want to add Google Analytics to the root of the Cassiopeia template, let’s follow the steps below.
Now, let’s start to Add Google Analytics to Cassiopeia Joomla 4 directly. First of all, open your Joomla 4 admin dashboard, then open System -> Site Templates.
After that, you just need to click on the Cassiopeia Details and Files to edit it.
In the tab Editor, simply access the index.php file in the /templates/cassiopeia folder. Moreover, you can also open the file by using FTP. It’s up to you.
Before the </body>
tag, t’s time for you to add the tracking code to the file.
Eventually, don’t forget to save all your change to ensure the code you add will be stored.
Using the KickstartCassiopeia module to add code
If you don’t want to change too much in the root of the Cassiopeia template, you can also use the KickstartCassiopeia module coming with a custom code option to Add Google Analytics to Cassiopeia Joomla 4. For more information about this module, please visit here.
In order to utilize this module to add code, you need to download KickstartCassiopeia first. After that, simply install the module to your Joomla 4 site.
Once successful installation, let’s go to Content -> Site Modules. On the search bar, you just need to enter the KickstartCassiopeia module, then click on it to edit.
With the free version, you are freely able to customize the layout, topbar, footer, etc of your Joomla site without coding knowledge requirement. We have already introduced to use of some options of the module in the previous blogs, you can explore them to find out more.
Now, in the Module tab, it’s necessary for you to set the published status as well as select the position you want.
In the Menu Assignment tab, since you use Google Analytics to track all pages, so let’s choose the On All Pages option.
After finishing the basic setup, let’s go to the Custom Code tab. The Custom Head Code is the place you need to paste the Google Analytics code you copied before.
Finally, simply save the module.
No matter what the way you choose to add the tracking code, it’s necessary for you to clear the Joomla cache after adding the Google Analytics code.
Everything is done. Don’t forget to check your result to ensure Google accepts your tracking code as well as tracking your Joomla 4 site data successfully.
Wrap Up
To sum up, we have already shared with you the methods to add Google Analytics to Cassiopeia Joomla 4. Thus, we hope that you can add a tracking code to your Joomla site without any trouble. If you use other framework templates for the Joomla website, you can also add Google Analytics by accessing the template you use, find the custom code tab to do this.
Besides, if you are looking for some tracking extensions for Joomla 3 & 4, let’s visit the collection of Joomla Google Analytics extensions. Last but not least, don’t forget to explore many responsive and high-quality Joomla 4 Templates whenever you need to change the appearance of your site. Thanks for your reading and have a great day.
- What’s J4 starter template and how to use it - December 3, 2024
- How to set Joomla tags different colors label-info - December 2, 2024
- JCE editor visual guides not showing: How to solve it? - December 2, 2024
It would be nice if you covered child themes here and overrides.
Thank you for your suggestion!
Actually, most of Joomla framework already has Custom Code, like Helix framework which we used to build our Joomla! 4 templates