Adding Google Analyitcs and Statcounter codes to yourwebsites is very easy to do, but can be very frustrating if not added correctly.
In this tutorial, we are going to quickly add both statistical trackers to our Sandvox websites.
The first code we will be adding is for Google Analytics. If you are unsure of what Google Analytics is and want to learn more, you can read up more about it on the Analytics website. In the meantime, here is a demonstration on how to add the code to your website. Open up your web browser to www.google.com/analytics.
If you do not have a Google account, you will need to click on the Sign up Now button. Otherwise, click on the Access Analytics button and login using your Google ID and password. Assuming this is your first time signing up for Google Analytics, you will need to click the Sign up button, located in the bottom left corner of the analytics page.
On the next page, you will need to enter your websites URL. You will also need to name the account. This name can be whatever you want it to be or you can simply leave it as your URL. Then select your country, and time zone, and hit the continue button. Fill out the remaining information required when signing up.
The final stage will ask you what you are tracking, which most of you can leave as A single domain. Finally, you will be told to paste a certain code on your site. Highlight that code and copy it by holding command and c or by going to Edit, and selecting Copy.
Head back to Sandvox, and in the menu bar, press Site, and then select Site Code Injection. Make sure that the Head Area tab is selected, and paste the code you just copied into the second of the two text fields. Your Google Analytics code will now be applied to all pages on your website.
Now I’m going to show you a very similar process, but this time we will be adding a Statcounter.com code. The first thing we will do, is open up our browser to www.statcounter.com. If you do not have an account with statcounter, click on the register button on the top left part of the navigation menu. Fill out all the required information and register your account. After you have registered, login with your username and password. Once you are logged in, you will need to create a new project in order to get your code. Click on the Add New Project button.
In the following form, you will need to enter a title for your website, your website URL, a category for your website, and your time zone. You also have the option of having the statcounter not count your visits to the site by blocking your IP. If you don’t care for this feature, just leave it blank.
After you click the “Next” button, you will then need to click on the Configure and Install Code button. You have a few options for which type of statcounter you want. It is recommend that you use the Invisible statcounter, that way, you are the only one who knows how many hits your site gets. Then click on the next button. Make sure that Default Installation Guide is selected from the drop down menu. Then press the Next button. Now we are given our Statcounter code. Again, we must highlight this code, and copy it.
Back in Sandvox, we must have our Site Code Injection window opened again. This time, make sure the Document Body tab is highlighted. Once again, we are going to paste the code we just copied in the second of the two text fields.
When you publish your site, the Statcounter and Google Analytics codes will be applied to every page on your Sandvox website, and you will now be able to track your website visitors.