You can add Google Analytics to your site for free. Follow the steps below. If you run into any snags, e-mail email@example.com for assistance. We're happy to help.
NOTE: Google Analytics is not part of Princeton's Google Account suite. You will need to get a separate account if you wish to use Analytics for your website.
The departmental Roxen servers (deptaedit and deptbedit) use the Universal Analytics tracking code (analytics.js). Sites that were using the old “ga.js” tracking code do not need to change anything. The same UA number, used in the “stat-id-string” variable, works with the newer code.
If you want to learn more about Google Analytics, visit the University's Lynda.com training website (login required) and search for "Google Analytics Essential Training."
Step 1: Get a Google Account
If you already have a Google account, and if you would like to use it, you are welcome to do so. If you would like to create a new account for only this purpose, you can do so for free at https://www.google.com/accounts/NewAccount.
Step 2: Get a Google Analytics Number (UA number)
Once you have the Google account that you would like to use, register for a free Google Analytics service at http://www.google.com/analytics.
Follow the instructions
If you are a new user to Google Analytics, you should follow their instructions titled "Get Started with Google Analytics".
Get Your Number
Your UA number will appear something like "UA-12345678-9." Copy this number.
Step 3: Add the UA Number to Your Site
Log in to the edit server for your site and enter the Content Editor (the file and folder view). Look for the variables.xsl file. The XSL template files should be listed near the bottom. If you do not have this file, please e-mail us at firstname.lastname@example.org.
Edit contents, and add the following code:
<xsl:variable name="stat-id-string" select="'UA-12345678-9'" />
Change "UA-12345678-9" to your UA number. Keep the single quotes inside of the double quotes.
"</xsl:stylesheet>" needs to be the last line of code on that page, so place the stat-id-string variable above this final line.
Commit "variables.xsl," and wait for front end replication (up to 10 minutes). Confirm within your analytics account that Google Analytics is receiving data for your site.
If you would like our help with this step, we would be happy to assist you. Simply e-mail email@example.com with your UA number and sitename, and we will add it for you.)