Blog Analytics without Javascript
1 min read

Blog Analytics without Javascript

As part of my migration from Wordpress to Ghost, I wanted a way to see how many views my posts had. This blog only gets a few hits per day - but over 10,000 people have seen my content over the past 2 years which serves as an incentive to keep writing!

My requirements:

  • It has to be free. A goal of this blog is to cost $0 to run (plus a few dollars per year for the domain name).
  • I'd prefer no Javascript.

I looked at a few options:

  • Google Analytics. It's free, simple, and everyone uses it. It also seemed like overkill for a blog that gets a few hits per day.
  • Simple Analytics. I couldn't find a free option, but this looked really neat.
  • No free option I could find.
  • Nginx server access logs - I have these on disk!

The last option is the one I went with. Nginx access logs have all the information I need - a timestamp and URL requested. This is enough to show me visitors per day and the most popular blog posts.

But I did not want to read through a log text file to get this information. Luckily, there's an open-source project called GoAccess that visualizes server log files. With one command, I could get a visualization via an HTML file:

goaccess /var/log/nginx/access.log -o analytics.html --log-format=COMBINED

That's all there is to it. That command generates an HTML page with charts and graphs with everything I need:

GoAccess Analytics Screenshot

Enjoying these posts? Subscribe for more