Google Analytics

One of the most frequently asked questions is ‘How can I find out about who’s visiting my website?’. Google Analytics is one of the most powerful tools around for gathering information about your website’s visitors - and best of all, it’s free to use on your site. Whilst we’re not going to look at the features of Analytics, instead we’re to look at how to integrate the Analytics system’s tracking code into your RapidWeaver-built site, but if you want to find out more, be sure to check out the Google Analytics site.

If you don’t already have one, sign up for a Google Analytics account at:

https://www.google.com/analytics/

Login to your Google Analytics account and Click the ‘+ Add Website’ Profile button - you will need to add a new profile for each website you want to track. After following the 3 step sign-up you will arrive at a screen similar to that shown in Figure 52 to reflect that we’ve added a profile for our own site.



Figure 1: Google Analytics Website


Getting the tracking code for your website

Now we have added a profile for your website, click the ‘Check Status’ to retrieve the tracking code for your site. You should tab entitled ‘New Tracking Code (ga.js)’ on the next page. Click that tab, and copy the code displayed [very similar to that shown below] to the OS X clipboard.


<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-xx");
pageTracker._initData();
pageTracker._trackPageview();
</script>

Now that we have the code we need to track visitors, return to RapidWeaver open the 'Stats' sidebar group. In the Configuration view, under 'Google Analytics' paste in the entirely of the code provided by Google.


Figure 2: Entering your Google Analytics Code

After this tutorial, you will need to re-publish the entire site to get the code to be placed on every single page. To do this, simply click ‘Publish’ after inserting the code. As all your pages will be marked as changed, RapidWeaver’s Smart Publishing will upload all the pages in your site.

Upon entering your HTML code into the Stats Configuration area, you'll see a Google Analytics field listed in the sidebar which will allow you to view your Google Analytics stats within RapidWeaver.