Code in theme header.html

Code in theme header.html

by Robert Bussell -
Number of replies: 8
I saw this code in the header.html of a theme. What does it do?

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

Thanks,

Rob
Average of ratings: -
In reply to Robert Bussell

Re: Code in theme header.html

by Ms. Royce -

Hello Robert,

It looks like some kind of tracking device for site visitors. Here is a link about Google Analytics http://www.google.com/analytics/

Best wishes...

In reply to Ms. Royce

Re: Code in theme header.html

by Robert Bussell -
As in spyware? I downloaded this theme from moodle.org.

I should probably remove the code then.

The theme is experience 247 v4

Thanks

Rob
In reply to Robert Bussell

Re: Code in theme header.html

by Patrick Malley -
Go ahead and delete it as it does nothing for your theme. The theme developer must want to keep track of your site visitors for some reason.
In reply to Patrick Malley

Re: Code in theme header.html

by Robert Bussell -
I deleted it. I am not fond of spyware. Surprised to find it in something related to Moodle.

Rob
In reply to Robert Bussell

Re: Code in theme header.html

by Klaus Brune -
This is the code for Google Analytics, as other people have already mentioned. As a big advocate of GA, I'd like to add a few points...
  • If you got the Theme for free and the designer just wants to get an idea of how many people are using it, then fair is fair, right?
  • However, this could should be in the footer, not the header. Specifically, right before the terminating </body> tag, as per Google's instructions. Putting it in the headier can make the entire site slow to load.
  • Also, if you want to track statistics for your site, signing up for GA is free, and I'd highly recommend checking it out and then putting your account information in the code.
  • If you're really going to use GA regularly, then one setup I've seen that is a good compromise is to cache the external urchin.js file and only update it from Google's site every 24 hours (the Google Analytics module for another CMS, Drupal, has the option of doing this built-in).
That's my 3 cents for the day. Hope it was semi-useful. smile