Installation

Installing Tiny Metrics boils down to embedding our lightweight JavaScript file on your website. This script is collects data and sends it to our servers for analysis.

Vanilla HTML

To install Tiny Metrics, copy and paste the following snippet into your website header, i.e. inside your HTML file between the <head> tags.

Snippet:<script src="https://tinymetrics.io/tm.js"></script>
Your index.html file:<html> <head> <title>My Website</title> <script src="https://tinymetrics.io/tm.js"></script> </head> <body> <h1>Welcome to my website</h1> </body> </html>

Next.js

Using Tiny Metrics with Next.js is essentially equivalent to vanilla HTML.

import Script from 'next/script' <Script src='https://tinymetrics.io/tm.js' strategy='beforeInteractive' />

You can consider using layout.{tsx/jsx} depending on your needs and the vesrion of Next.js you are using.

WordPress

It is straightforward include Tiny Metrics on your WordPress website. The basic idea is identical to the "Vanilla HTML" section. Edit your theme's header.php file, and include this snippet in its header:

<script src="https://tinymetrics.io/tm.js"></script>

If you are unsure how to edit your theme, check out this tutorial.

Verification

The simplest way to verify that the Tiny Metrics script has been installed correctly is to navigate to your website, visit a few different pages, and subsequently check your Tiny Metrics dashboard. Your data should show up almost immediately.