Adding Google Universal Analytics to CM1 Account

When my CM1 was set up, I used the Google Widget to create a connection to our Google Analytics. Now that Google has Universal Analytics, will the widget include this? If not, how is the best way to add the new code to all of my pages?

Hi David,

What the current Google Setup gadget does is it automatically inputs the Standard Google Analytics tracking code into the

section of all of pages of the particular site that you have assigned a GA profile to. The Google Setup gadget does not support Universal Analytics at this time, so your best alternative will be to manually add the new Universal Analytics tracking code to the Additional Head Content meta-data insertion point for all of your site’s templates.

To do this, go into the Design section of CM1 and double-click on your site, at which point all of your site’s templates will appear. Select the blue pencil edit icon above a template, switch over to the Content tab, hover over Actions, and select Edit Meta-data. In the menu that pops-up you will find an Additional Code menu that you can expand, and in this menu you will find the Additional Head Content text field that you will want to paste your Universal Analytics tracking code into. Once you’ve done so, hit Save, close the template, and move onto the next template.

Once you’ve added this code to all of your templates (and subsequently, all of your site’s pages), you can go ahead and run a full site publish. Note that the tracking data will have to be retrieved directly through Google’s Universal Analytics site, as the existing CM1 GA tracking tools will still be connecting to your old Standard Google Analytics profile.

When I go into the Design section, I don’t have my site listed. It’s web_resources and I don’t see templates in there. Am I in the wrong area?

Hey David, by Design section, I mean the the template design area of CM1, which is accessible through CM1’s main drop down menu in the upper left corner of the UI (the link to this menu will display your current section and a downwards arrow, e.g. “Dashboard ∨”). The design link in the Finder that you had selected is commonly referred to as the design library, but I completely understand how this can be a bit confusing.

Makes sense.

Follow up question. If I put this on all of the templates, there is a chance one page could have multiple instances of the code, right? Do you think that would be an issue with Google? I could probably parse out a few templates that cover all of the pages, but was curious.

Thanks.

Hey David,

Actually, this should not be an issue (unless you have manually added this code to individual pages previously). A page can only be assigned to one template in CM1, so you aren’t going to encounter a case where adding this code to all templates will ever result in duplicate content.

Hi Nathaniel,

11 months on, is Universal Analytics now supported?

I’ve just tried to set up a customer and run head-long into the Google sign-in problem, that I just can’t get around. But I won’t even persist if UA is not supported. It’s a shame because it means that Analytics is recording visits to CM1 too: not ideal…

Thanks,

Oliver

The OOB capability to embed a GA snippet on every page does not support Universal Analytics. However, if you wish to use UA, you can insert the snippet in the meta-data of your templates. 

I would also like to get on the Universal Analytics bandwagon. Its been 6 months from the last post.

It’s not even an option any longer to use the older style code in Google Analytics.

Is there a plan to upgrade to UA ever?

HI Guys I need this too. I’m trying to use the track out bound links GA code and it works best with Universal.

Another question for you. Can you put your universal GA code into an external js file and then include the js file on each page?

I have a scripts.js file that I included on each template in the meta data, addtional code area so when I need to blanket the site with something like this I just have to go to one file to update the code.

I’m still new to js though so I’m not sure if this works with the GA code. Anyone know?

I would love to have the new analytics. Let us know when this is implemented.

I believe this would work Sandy.

Thanks guys. I did get this to work in an external js file. Works well, I’ll try and paste my implementation here. I just unhooked the cm1 google setup on the dashboard, and then added this to the additional code section on my templates;

I don’t fully understand the async part , but from what I gathered it has something to do with how it tracks events on your page even before the whole page is done loading. I think its important to your analytics in-order to track load times of your pages and if people leave the page before its done loading etc… Could be wrong here, please correct me if I am, but that’s what I understood. You don’t want to have your GA function inside a document.ready function anyway.

One thing I learned about the trackOutboundLink function was make sure in your onclick event (on your links) that you are using the right kind of double and single quotation marks or the whole thing fails. (don’t copy the ones from the Google page, they are the wrong characters, just type them in from your keyboard.)

my link tags

my JS file

(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(‘create’, ‘UA-616432-1’, ‘auto’);
ga(‘send’, ‘pageview’);

var trackOutboundLink = function(url, action) {
ga(‘send’, ‘event’, ‘outbound’, action, url, {‘hitCallback’:
function () {
document.location = url;
}
});
}

Then when you go into your google account under events / actions you will see “link to student portal” listed. To test if its working without waiting the full 72 hours go under realtime / events and click your link on one screen while your google account is open on the other screen, after a few seconds you should see a spike and it register if its working.

ok so it won’t show my link tags. If you want to see go to my site www.oldscollege.ca and do an inspect element on the mail icon in the red bar at the top of the page.