If you run a markdown blog or another type of static site, you’ll eventually want to track how people use it. Whether you are interested in seeing which posts get the most attention, finding out where visitors are coming from, or checking how often someone returns, analytics can help.
For most static sites, including those built with hosted.md, adding analytics is simply a matter of placing the right code in your site’s HTML. Right now, hosted.md allows you to edit the HTML of your theme layout, so you can paste your analytics tracking code directly into the <head>
section.
In the future, there will be a dedicated Analytics area in the settings panel. This will let you add Google Analytics, Plausible, Fathom, or other tools without having to touch any code at all. Until then, here’s how you can get started.
Step 1: Choose your analytics provider
The most common option is Google Analytics, which offers detailed insights into visitor behavior. However, if you prefer privacy-focused tools, there are excellent alternatives such as:
- Plausible Analytics – lightweight, privacy-friendly, and cookie-free
- Fathom Analytics – simple dashboard with strong privacy features
- Umami – open source and self-hosted if you want full control
Choosing the right provider depends on your needs, budget, and approach to privacy.
Step 2: Get your tracking code
Once you create an account with your chosen provider, you will receive a snippet of JavaScript. For Google Analytics, this is often referred to as the “Global Site Tag” or gtag.js
. For other providers, it may simply be called the tracking script.
Keep this snippet handy. You will need to paste it into your theme’s HTML.
Step 3: Edit your theme layout in hosted.md
- Open your hosted.md dashboard and go to your site’s theme editor.
- Locate the main layout file for your theme. For the first theme, this will be
layouts/default.html
.
- Find the
<head>
section of your HTML.
- Paste your tracking code just before the closing
</head>
tag.
- Save your changes and rebuild your site.
Step 4: Confirm that analytics is working
After publishing, visit your site in a new browser tab and then check your analytics dashboard. Most providers will show live visitor data so you can confirm that the connection is active.
Why this will get even easier in hosted.md
Right now, adding analytics is a quick process if you’re comfortable pasting code. In an upcoming update, hosted.md will include a dedicated Analytics settings page where you can choose your provider, enter your tracking ID, and have the system insert the code automatically. This means you won’t need to edit HTML files directly, and you’ll be able to switch providers without touching your theme.
In short: Adding Google Analytics or any other tracking service to your static markdown blog only takes a few minutes. Whether you choose Google Analytics for its detail or a privacy-first option like Plausible, you can set it up today with hosted.md by pasting your code into the theme layout. And soon, you’ll be able to do it right from your dashboard settings.