Jarle Aase

Stbl and Google Analytics

bookmark 1 min read

Some people want Google Analytics enabled on their sites. I personally think that is a horrible idea, as it gives Google full insight into who is visiting your blog, what pages they read, and how much time they spend doing that. This again, combined with other data Google owns, allows them to create profiles on those visitors that can tell more about them than their mothers or wifes knows. Today for marketing. Tomorrow - who knows. If you have read the book 1984, you probably have an idea.

Anyway, I'm not judging you, just giving a friendly warning that allowing Google (or Microsoft, or Amazon or ...?) access to this data is potentially dangerous or even disastrous.

So, if you want to go ahead anyway, it's simple.

Log on to Google Analytics, add a new site, and copy the little javascript snippet they make for your site to the clipboard. Create a new file in the stbl content-directory in a directory named scripts, and paste your Google Analytics javascript snippet there. Save the file.

For example, on one of my sites (one that has very little traffic and is aimed at business people only), the root stbl directory looks like:

$ ls -1

If we look at the scripts directory:

$ ls -1 scripts/

I have used a .html file extension for my script, to make it easy for my text editor to understand that I want html editing mode for that file. The extension does not matter. Stbl will take all the files in the scripts folder and put their content in all the pages it generates for the site.

Thats all! Just put the javascript from Google Analytics in a file in the scripts folder, regenerate and publish your site, and you are done.