google analytics not working - RESOLVED

Permalink 1 user found helpful
Hi,

I'm working from a Natural Concrete theme and I've tried installing google analytics in a number of ways to no avail. I've contacted the theme creator but I need to figure this out quickly.

I've done it through the Dashboard > Tracking Codes, but when I go to save it the entry disappears. If I inspect the document I end up seeing the ga.js entry in the <body> but it's a lot longer than the regular tracking code I copied and pasted from GA. After waiting many hours it still doesn't show up in GA.

I also tried inserting the snippet before </head>, before </header>, after <body>, before </body>, and before </footer> and again I can see the long entry(too long to show here), but after waiting a good amount of time I couldn't see the entry in GA.

<?php Loader::element('footer_required'); ?> is present in 'footer.php' and I believe that's where the C5 dashboard entry goes. I've also cleared the cache as per usual.

Do you have any thoughts on what might be going on?

my ga.js is as follows:

<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','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXXXXX-X', 'XXXXXXXXX.com');
ga('send', 'pageview');

</script>

lackadaize
 
mkly replied on at Permalink Reply
mkly
Hello,
What version of concrete5 are you using?
lackadaize replied on at Permalink Reply
lackadaize
5.6.1. I've also tried to do the php implementation described in google analytics with the analyticstracking.php file
lackadaize replied on at Permalink Reply
lackadaize
no matter what I do in the header or footer it forces the ga.js to the body? Most everything I've seen on here says to put it in the header or footer but GA wants it just before the </body> tag. I don't understand. my site is athttp://www.eclinicalsol.com if that helps at all.
lackadaize replied on at Permalink Reply
lackadaize
I also noticed that I have no elements/footer_required.php. Does this mean anything? I have a elements/header_required.php.
Phallanx replied on at Permalink Reply
Phallanx
You're using Miser so add the following to your site.php to regain control

define('MISER_ENABLE','');


Then clear your cache
lackadaize replied on at Permalink Reply
lackadaize
in the miser site.php right?
lackadaize replied on at Permalink Reply
lackadaize
nevermind what I just said.
lackadaize replied on at Permalink Reply
lackadaize
phallanx thank you so much. You keep coming through for me. You're awesome.
Phallanx replied on at Permalink Best Answer Reply
Phallanx
Miser doesn't have a site.php. Put it in the concrete5 site.php in the config folder.
lackadaize replied on at Permalink Reply
lackadaize
yeah I realized that right after I typed it. It all looks good now, GA is in the header where it should be. thanks again for your help.
Phallanx replied on at Permalink Reply
Phallanx
Miser can place it in the head, but it is better you keep it turned off.