Joomla 4 - Google Analytics Adding Tag Mr Script Topic is solved
Moderator: General Support Moderators
Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10
- Duckdown
- Joomla! Enthusiast
- Posts: 136
- Joined: Sat Jun 25, 2016 7:00 am
Joomla 4 - Google Analytics Adding Tag Mr Script
I have got the script for Google Tag Manager but can't find where to copy it and my brain needs a few more specifics than what I have seen
From what I have found so far I have tried:
1. Dashboard 2. System 3. Manage Extensions 4. Templates (Locked) If this is the right place Do I unlock?
also:
1. Dashboard 2. System 3. Site Templates 4.Cassiopeia Details and Files (Also looked at Options)
I recall some years ago finding HTML coding in Joomla 3 and presume that is what I am trying to find now?
In particular index.php. I am not sure how I get this script into there and all my pages.
I think someone mention creating an HTML module.
Another script is supplied during creating Tag Mr acvcount that goes after opening <body> . I am not sure that has to go on every page?
From what I have found so far I have tried:
1. Dashboard 2. System 3. Manage Extensions 4. Templates (Locked) If this is the right place Do I unlock?
also:
1. Dashboard 2. System 3. Site Templates 4.Cassiopeia Details and Files (Also looked at Options)
I recall some years ago finding HTML coding in Joomla 3 and presume that is what I am trying to find now?
In particular index.php. I am not sure how I get this script into there and all my pages.
I think someone mention creating an HTML module.
Another script is supplied during creating Tag Mr acvcount that goes after opening <body> . I am not sure that has to go on every page?
- Duckdown
- Joomla! Enthusiast
- Posts: 136
- Joined: Sat Jun 25, 2016 7:00 am
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
Okay a bit more search and I found index.php
1. Dashboard 2. System 3. Site Templates 4, Cassiopeia Details & Files 5. Index.php
I selected index.php and at line 116 was <header>
Here are the lines 114 to 116 <head>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
(Should I include the script here or:
<jdoc:include type="metas" />
<jdoc:include type="styles" />
<jdoc:include type="scripts" />
HERE???????
</head>
Does this do it for every page?
The other noscript should it go directly under line 122 which is
<body class="site <?php echo $option
1. Dashboard 2. System 3. Site Templates 4, Cassiopeia Details & Files 5. Index.php
I selected index.php and at line 116 was <header>
Here are the lines 114 to 116 <head>
<!DOCTYPE html>
<html lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>">
<head>
(Should I include the script here or:
<jdoc:include type="metas" />
<jdoc:include type="styles" />
<jdoc:include type="scripts" />
HERE???????
</head>
Does this do it for every page?
The other noscript should it go directly under line 122 which is
<body class="site <?php echo $option
-
- Joomla! Enthusiast
- Posts: 146
- Joined: Sat Sep 21, 2019 7:29 pm
- Contact:
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
Put the tag manager script as close to the opening <head> tag as possible, but below any dataLayer declarations.
Adding it to the template index file will mean that it is added for every page.
Adding it to the template index file will mean that it is added for every page.
Joomla Developers Available To Help With Joomla!
https://www.helpwithjoomla.com
https://www.helpwithjoomla.com
- Duckdown
- Joomla! Enthusiast
- Posts: 136
- Joined: Sat Jun 25, 2016 7:00 am
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
helpwithjoomla: What will happen to it when I do an update to Joomla?
-
- Joomla! Champion
- Posts: 5620
- Joined: Tue Aug 23, 2005 1:56 pm
- Location: South coast, UK
- Contact:
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
It will be overwritten. Create a child template then it will not be overwritten on updates.
https://gadsolutions.biz Electrical services
https://electrical-testing-safety.co.uk Testing services
https://electrical-testing-safety.co.uk Testing services
- Duckdown
- Joomla! Enthusiast
- Posts: 136
- Joined: Sat Jun 25, 2016 7:00 am
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
Thanks gws. That is another aspect I will have to explore.
-
- Joomla! Enthusiast
- Posts: 146
- Joined: Sat Sep 21, 2019 7:29 pm
- Contact:
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
Here's a link for creating a Child template with J4: https://docs.joomla.org/J4.x:Child_Templates
Joomla Developers Available To Help With Joomla!
https://www.helpwithjoomla.com
https://www.helpwithjoomla.com
- Nidzo2203
- Joomla! Explorer
- Posts: 303
- Joined: Sat Nov 21, 2009 4:52 pm
- Contact:
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
Install this plugin https://extensions.joomla.org/extension/phoca-site/
and put your G4 analytics code in header.
Don't complicate.
and put your G4 analytics code in header.
Don't complicate.
- Duckdown
- Joomla! Enthusiast
- Posts: 136
- Joined: Sat Jun 25, 2016 7:00 am
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
Nidzo2023: Tnx I shall look at that, but I think I still have the problem of updates to Joomla?
- Duckdown
- Joomla! Enthusiast
- Posts: 136
- Joined: Sat Jun 25, 2016 7:00 am
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
After considering all the suggestions here and lots more research, I came across a very helpful individual that guided me through the process below. It is also a steep learning curve to navigate my way around the Google Analytics site and understand what it presents. At this stage I don't need much information. Just how many visits and where they are coming from. They suggested it might be up to 48 hours before I see anything but here we are about 10 hours later and it indicates 1 visitor, from China. Mmmmm. Anyway here is what I did in my backend after signing up to Google analytics and getting script.
1. Created Module named Goggle Analytics
2. Copied script provided by Google into Code (not Editor) of the module. I use JC Editor
3. Assigned page position “Top-Bar” Cassiopeia
4. Save Module
5. Components>JC Editor>Profiles>Default>Editor Parameters>Advanced.
6. Under Code Blocks: Enable Yes Allow Script Yes Allow CSS Yes (didn't touch anything below these)
7. In modules move the Google Analytics module above the Banner Image
(position top-bar)
NB: Have I missed anything? Was there something I changed in Global Config? I make scribble notes and then enter all these things into a document for future references.
Someone might assess this for others to consider.
1. Created Module named Goggle Analytics
2. Copied script provided by Google into Code (not Editor) of the module. I use JC Editor
3. Assigned page position “Top-Bar” Cassiopeia
4. Save Module
5. Components>JC Editor>Profiles>Default>Editor Parameters>Advanced.
6. Under Code Blocks: Enable Yes Allow Script Yes Allow CSS Yes (didn't touch anything below these)
7. In modules move the Google Analytics module above the Banner Image
(position top-bar)
NB: Have I missed anything? Was there something I changed in Global Config? I make scribble notes and then enter all these things into a document for future references.
Someone might assess this for others to consider.
-
- Joomla! Apprentice
- Posts: 25
- Joined: Sat Apr 09, 2022 2:38 pm
- Location: Beograd
- Contact:
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
google analytics or google tag manager script at the end?
- Duckdown
- Joomla! Enthusiast
- Posts: 136
- Joined: Sat Jun 25, 2016 7:00 am
Re: Joomla 4 - Google Analytics Adding Tag Mr Script
jovanddd I am not sure how to answer your question but suggest this link may be worth having a read of. Probably clarifies better the steps I took (see above).
https://www.kuneze.com/blog/126-how-to- ... extensions.
During all this research I found my host already provides the facility to analyse. I guess it is worth having the two to compare.
https://www.kuneze.com/blog/126-how-to- ... extensions.
During all this research I found my host already provides the facility to analyse. I guess it is worth having the two to compare.