Free static hosting with server-side analytics

Comparing GitHub Pages, Netlify, Cloudflare, Google Cloud and Vercel

September 21, 2021

This blog has been hosted on GitHub Pages for a while, but I was getting frustrated of not having any idea of the traffic it was getting, and I was really curious to find out.

The only way to get traffic insights on GitHub pages is through client-side analytics scripts, which is technically very unreliable, and Iā€™d rather not get any data than getting data that I cannot trust, and which on top of that negatively impacts the performance of my site.

What I want is raw access to HTTP logs, which is the only proper source of truth for this.

In the first part of this series, Iā€™ll compare different free static hosting services and their options to get access to server-side analytics or logs. Then, Iā€™ll show you in the second part how to retrieve logs on a Vercel app, which is the only service I found to provide HTTP logs as part of their free offer!

GitHub Pages

GitHub Pages is the easiest option to host a static website for free, especially if youā€™re already working with GitHub, but it doesnā€™t have an option to access HTTP logs.

The only method they document is using Google Analytics or a similar script, but thatā€™s not an acceptable solution to me. Letā€™s move on.

Netlify

Netlify is my next favorite way to deploy a static website. They also have a Netlify Analytics, product, an analytics platform based on server logs, which is exactly what I want!

As they point out in their marketing page, itā€™s ā€œdata right from the source of truthā€, itā€™s got ā€œbetter performanceā€, ā€œmore accurate numbersā€, ā€œbetter privacyā€ and gives you access to extra metrics you can only get on the server side.

To me this the only proper way to get traffic analytics on the web.

But they price that feature at $9 per month per site, which to be honest is pretty decent if you have a website thatā€™s generating some cash, but my blog is not and my current budget is closer to $0.

And sadly, if not interested in the full blown analytics product, thereā€™s no way to only get the raw server logs.

Cloudflare

Cloudflare also has a free static hosting offer. Theyā€™ve got a Cloudflare Analytics product, but the free version is only powered by a client-side script, which as we saw earlier, is useless.

Otherwise, the option to have analytics based on server logs starts with the ā€œproā€ plan thatā€™s $20 per month. Too much for me.

They also offer Cloudflare Logs which seems like it would at least give access to raw HTTP logs, but the pricing is not mentioned and you need to contact their sales department to maybe get access to it. Doesnā€™t look good.

Render

Render is another service with free static hosting, and a itā€™s a very well built product. Simple and efficient. Out of all the websites in this list, itā€™s the one with my favorite UI so far. Gets shit done, no bullshit. šŸ˜

I especially love the fact that they allow to configure any public Git URL to pull from, without forcing you to connect with GitHub or another hosted Git provider through OAuth like itā€™s the case with Vercel.

Sadly, while you can configure a syslog drain, it only forward application logs and doesnā€™t include edge load balancer HTTP logs, which is the only thing I care about.

Google Cloud free tier VM

While itā€™s very different from the other managed services I mention in this list, Google Cloud allows you to run a e2-micro instance constantly for free.

The e2-micro instance has access to 0.25 vCPU and can burst up to 2 vCPUs. Itā€™s got 1 GB of RAM, and youā€™re allowed up to 30 GB of storage for free. You can even assign it a static IP that will stay free as long as itā€™s in use.

Itā€™s a pretty underpowered machine but will be way fine for serving static websites, for example with nginx, as long as it doesnā€™t have a ridiculous amount of traffic.

The only caveat is that you still have to pay for traffic.

Ingress traffic is free (data going in the VM), but youā€™ll have to pay for egress traffic (data going out of the VM). In other words, this means that someone uploading a large file to your VM will be nearly free, but serving a large file to someone will impact your billing.

Typically this is low enough to be negligible, but Google will be happy to charge your credit card for $0.03 every month.

And because youā€™re the server, you can do whatever the fuck you want, like logging HTTP traffic to /var/log.

This solution requires a bit of system administration knowledge, but if like me, you find it to be exciting and a lot of fun, itā€™s definitely a good solution. That being said youā€™ll also be responsible of managing the VM, keeping it up-to-date, and fixing any issue that might happen with it, otherwise you website might get some downtime.

Vercel

Finally, Vercel also has free static hosting. Yay!

They even have a Vercel Analytics product, but itā€™s mostly focused on performance, and the data is captured on the client side. Makes sense for performance data, but not what I want.

They also have logs, which can even be persisted, through logging integrations.

This is great, but the whole point Iā€™m doing this comparison is because I want a free hosting with logs. If Iā€™m not willing to pay for hosting, Iā€™m not going to pay for Logtrail, Sematext, Datadog or LogDNA. šŸ˜†

The good news is that the logging integrations are built on top of log drains, and Vercel allows to create custom integrations. This means that we can create our own custom integration, and for example, configure a log drain that forwards the logs toā€¦ a Google Cloud free tier VM!

This is the best of both words, because Google Cloud wonā€™t charge for ingress (and sending data to it is indeed ingress), so weā€™ll only pay for the egress of our SSH session where we query the log files, but thatā€™s going to be negligible.

In the next post, Iā€™ll show you how to set up Vercel with a custom integration to forward logs to a Google Cloud VM (or the log drain of your choice). See you there!

Want to leave a comment?

Join the discussion on Twitter or send me an email! šŸ’Œ
This post helped you? Buy me a coffee! šŸ»