Google Analytics 4 and Joomla 2.5.x

Need help with the Administration of your Joomla! 2.5 site? This is the spot for you.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
JudyAnn
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Fri Jun 10, 2011 4:23 pm

Google Analytics 4 and Joomla 2.5.x

Post by JudyAnn » Thu Dec 01, 2022 8:12 pm

I maintain an old Joomla 2.5 website which uses Google Analytics that is coded in a module for the site. While there is a module that can be added to Joomla 3.x or 4.x sites, I cannot find any for the old 2.5 sites.

I am assuming it uses Universal Analytics but I cannot sure.

​var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-99999999-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

I realize I need to get a new Google Analytics 4 code that starts with G- but I don't know if there are any other properties or variables needed for it to work with Joomla 2.5?

User avatar
AMurray
Joomla! Exemplar
Joomla! Exemplar
Posts: 9713
Joined: Sat Feb 13, 2010 7:35 am
Location: Australia

Re: Google Analytics 4 and Joomla 2.5.x

Post by AMurray » Thu Dec 01, 2022 9:16 pm

You have mentioned the 'old' 2.5 site, and therefore you shouldn't really be using a nine-year old CMS to start with (which is why you can't find extensions for it).

The code should be inserted into the template's index.php file. There no "harm" in this since J 2.5 won't have any updates that might overwrite the code.

My advice, work towards getting your site updated to 3.10 at minimum which would have available plugins to help with inserting the GA code.
Regards - A Murray
General Support Moderator

JudyAnn
Joomla! Intern
Joomla! Intern
Posts: 55
Joined: Fri Jun 10, 2011 4:23 pm

Re: Google Analytics 4 and Joomla 2.5.x

Post by JudyAnn » Fri Dec 02, 2022 3:51 pm

AMurray wrote:
Thu Dec 01, 2022 9:16 pm
You have mentioned the 'old' 2.5 site, and therefore you shouldn't really be using a nine-year old CMS to start with (which is why you can't find extensions for it).

The code should be inserted into the template's index.php file. There no "harm" in this since J 2.5 won't have any updates that might overwrite the code.

My advice, work towards getting your site updated to 3.10 at minimum which would have available plugins to help with inserting the GA code.
I know the site needs updating and have been pushing for it for years (5+). They (the customer) actually had a contract signed to have it re-done, but then the owner of the company with the contract died. I swear this site is cursed.

The management I work with now is setting up for the roll-over to GA4 for all of our sites. So hopefully someone more experienced than I can guide me with it.


Locked

Return to “Administration Joomla! 2.5”