How do I install Google Analytics to my Concrete5 website?

Permalink 1 user found helpful
Im not quite sure where/how to insert the Google Analytics tracking code?

I've tried adding it to the Home Page content block, but that didnt work.

Any help would be greatly appreciated!

View Replies: View Best Answer
VidalThemes replied on at Permalink Best Answer Reply
VidalThemes
Hi There,

Hover your dashboard button and select "systems and settings" under the heading "seo and statistics" you will see "tracking codes" click that and then paste your code in there.
zoinks replied on at Permalink Reply
Should Google Analytics be in the header or footer with C5? I think GA recommends header for some weird reason, but then I think I read it should be footer in C5. Any idea?
Scafidi454 replied on at Permalink Reply
Scafidi454
Putting the script into the "page header" on the main page does yield results. However, putting it into subsequent pages / page types doesn't.

Where are the page templates for active pages stored?

I just found out, earlier this morning, that the maintenance_mode.php file that the site points to in order to display to public is not actually in /**/concrete/views/frontend - Instead, it's in public_html/updates/concrete5.7.5.8_remote_updater/concrete/views/frontend - So, maybe my theme pages (to insert the tracking code) is somewhere in there?

I'll keep digging.
Scafidi454 replied on at Permalink Reply
Scafidi454
Here's the easiest thing I've found, in the site header, in the CMS (not the backend PHP code), place your unique script tracking code somewhere in an HTML block:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'YOUR ANALYTICS TRACKING CODE', 'auto');
ga('send', 'pageview');

</script>



And it will report for each page accessed within the site automatically.