Embed the script

Every site has its own embed script, tied to the domain you configured when you added it. Installing Tinylytics means copying that one tag from Settings โ†’ Tracking and pasting it into your pages, ideally just before the closing </body> tag. It works in <head> too, as long as you keep defer on it so the browser does not wait for us before painting the page.

Install section under Settings โ†’ Tracking

Click the snippet in Settings and it copies itself.

<script defer src="https://tinylytics.app/embed/YOUR_EMBED_CODE.js"></script>

That is the entire installation. Load one of your own pages and the hit should appear on Overview within a moment.

A smaller file

If you would rather ship fewer bytes, add /min to get a minified build. It behaves identically.

<script defer src="https://tinylytics.app/embed/YOUR_EMBED_CODE/min.js"></script>

Single-page apps

A normal page load is easy to count. An app that swaps the URL without loading a new document is not, because the script never runs again. Adding ?spa loads a version that can count more than once per document.

<script defer src="https://tinylytics.app/embed/YOUR_EMBED_CODE.js?spa"></script>

With ?spa, Tinylytics counts the first view, counts again on every turbo:load event, and exposes window.tinylytics.triggerUpdate() so you can count a view yourself. If you use Turbo, that is all you need. If you use React Router, Vue Router, or anything else with its own history handling, call triggerUpdate() after each navigation:

window.tinylytics?.triggerUpdate()

Repeat calls for the same URL are ignored, so an over-eager router will not double-count. You can combine ?spa with /min.

Hosts that will not accept a script tag

Some publishing platforms strip <script> out of your templates. Write.as is one. Where you can still run JavaScript, build the tag instead of pasting it:

let script = document.createElement("script")
script.type = "text/javascript"
script.defer = true
script.src = "https://tinylytics.app/embed/YOUR_EMBED_CODE.js"
document.body.appendChild(script)

Widgets and events come from the same tag

You do not add more scripts to get more features. The same URL accepts query parameters for hit counters, kudos, country flags, uptime, and the webring, and for event tracking. Get the plain script counting first, then add parameters when you want the extras.

Keep your own visits out

While you are building, visit your live site once with ?tiny_ignore=true on the end of the URL. That leaves a flag in the browser’s local storage and your own reloads stop counting. Ignoring your hits covers the details, including how to undo it.