.

MIT Libraries

Web Guidelines: MIT Libraries

Google Analytics

This code, when placed in individual pages, attaches them to the Google Analytics statistics-gathering program. As of February, 2008, Marion has finished placing an SSI into every page on the Libraries site, to include the GA code. (What's SSI?)

REMEMBER: If you want to edit a Guide, please remember to download and work with the updated guide from the server (rather than using something already on your hard disk), so the GA code won't be lost.


 

Does my page have the code yet?

As of February, 2008, Marion has finished placing an SSI onto every page on the Libraries site, to include the GA code. She may have missed a few very deep pages, or you may have created a new page after she finished your directory. If your page is missing the code, please ask Marion to to help!

To check in a browser:

  • choose "view source"
  • scroll to the bottom
  • you should see this code:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1760176-1";
urchinTracker();
</script></body>

To check in Dreamweaver:

  • open in code view
  • scroll to the bottom
  • you should see code like this (the number of "../" will vary):

<!--#include virtual="../../googleanalytics.txt" --></body>

What can I do to make sure the code lands in my new page?

If you're making a new page, you have a few options:

For Dreamweaver-template based pages (eg, Subject Guides):

- download a current live guide from the server and edit or "save-as" (rather than using something already on your hard disk), to take advantage of the GA code Marion has already added.
OR
- create a brand-new guide, based on one of the latest guide templates, at http://libraries.mit.edu/templates/. These all contain the GA code.
(NOTE: if you're trying to update an old template-based page, see Applying the current template to an old CSS guide.)

For non-Dreamweaver template pages:

- If you're creating a brand-new "Blue Stripe" page (either expandable or fixed-width), you can base your page on one of the pages here, which contain the GA code:
http://libraries.mit.edu/about/templates/

- If you're creating a new "Colorbar" page -- eg,
http://libraries.mit.edu/aero/contact.html
...there's no central template for this, although there should be versions in each library's locker. Please ask Marion for help if there's no template in your locker.

Can't I just add the code myself?

To add it to Dreamweaver-template based pages (e.g. subject guides), download & apply the current template. For anything else, add this code:

<!--#include virtual="../googleanalytics.txt" -->

just before </body> in your page's code.

If the page is in a sub-directory, of course, the code should indicate a deeper page - eg:

<!--#include virtual="../../googleanalytics.txt" -->

To test the code, upload it to the -test directory and View Source. If the SSI is spelled and placed correctly, you should see, at the bottom of the source page,

<script type="text/javascript">
_uacct = "UA-1760176-1";
urchinTracker();
</script></BODY>

</HTML>

If the SSI is set up wrong, you'll get a visible error message on the non-source page. (What's SSI?)

How can I check the statistics once the code's there?

Go to:
http://google.com/analytics/

Sign in:
email: webstats-lib@mit.edu
password: mitlibraries

Click on "view reports" next to "libraries.mit.edu."
Try the "content drilldown" section under "content" in the left nav bar.

Nicole says, as of 9/28: I'm still learning about what all these stats mean (I have a couple of huge books about it that I haven't read!)

So your guess is as good as mine as to what it all means... just read the help files, since I'm not prepared to answer any questions about it yet.

 

 

 

 

 

 

 

last edited mlcar 3/6/08