You may use Google Analytics to track and report on the usage of your dotCMS sites. This document provides step-by-step instructions on how to set up Google Analytics, and reviews several examples of Google Analytics reports which may be useful for monitoring your site.
Visit the Google Analytics sign up page.
Copy the Tracking ID and the Google Analytics code provided, and save them to a safe location. These will need to be entered into your dotCMS site (see below).
</head> tag.
Sample Header Container Code:
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Sample Website Name</title>
<link rel="stylesheet" type="text/css" media="screen, projection" href="css/screen.css" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/scripts.js" type="text/javascript"></script>
<STYLE TYPE="text/css">
<!--
.indented
{
padding-left: 25pt;
padding-right: 25pt;
<ul type="disc">
}
-->
</STYLE>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '<b>${esc.d}${esc.e}{host.googleAnalytics}</b>']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>To ensure that all pages on your site are tracked, you must make sure that the Header (which now includes the Google Analytics code) is included in all your Templates.
<head> tag, click the "Add Container" button and include the header container (from the previous step, above). It will look similar to the following (though the identifier of the container may be different):<head>
## Container: dotCMS - Header (head)
## This is autogenerated code that cannot be changed
#parseContainer('280a1aff-f6fd-496e-ba20-cb6640e3b042')
</head>Wait 24 hours and revisit Google Analytics. Statistics and reports should now be viewable on the Google Analytics account.
The following screenshots are examples of only a few of the Standard reporting options included in Google Analytics.
Display and filter: