Adding Google Analytics Tracking Code

Permalink 1 user found helpful
Are there any plans to change the tracking code to be added between the <head></head> tags? I am not an admin and cannot change the global .php code. It is like pulling teeth to get the admin to do anything as well. I don't see it in today's upgrade notes.

RandomBrad
View Replies:
RandomBrad replied on at Permalink Reply
RandomBrad
The tracking code works just fine in the current location. Not sure if they are planning on moving it but is there a specific reason why?
wanderlust replied on at Permalink Reply
wanderlust
There is a specific reason why - Google Webmaster tools and on page analytics require the tracking code to be placed between the head tags. Any chance this is on the docket? The fix would be extremely useful.
wanderlust replied on at Permalink Reply
wanderlust
There is a specific reason why - Google Webmaster tools and on page analytics require the tracking code to be placed between the head tags. Any chance this is on the docket? The fix would be extremely useful.
joseajohnson replied on at Permalink Reply
joseajohnson
There is a way to insert your tracking codes between the head tags.

It may be a little more time consuming than shooting a request to your admin to modify your theme/required header, but should get the job done.

Follow the procedure for each of your pages, or at least those that require tracking.

From the Page while logged in,

Edit Page > Properties > Custom Attributes > ** Add Attribute > Header Extra Content

Paste the code provided by Google into the 'Header Extra Content' Input that appears, then hit the 'Save' button at the bottom of the page.

This is an issue others have experienced, and will apparently be addressed in a more global fashion presently:

http://www.concrete5.org/community/forums/customizing_c5/custom-att...

Being able to specify default custom attributes by pagetype to be applied site-wide would do the trick; likely there'll be an add-on patch that accomplishes the same soon enough.

Good luck!
Scafidi454 replied on at Permalink Reply
Scafidi454
http://prntscr.com/bt6qfx

I've tried the built-in tracking code, adding the "analyticstracking.php" file and referencing it in the index, them page.php files, and in an HTML block on the global site nav. Nothing...
Scafidi454 replied on at Permalink Reply
Scafidi454
.
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.