Integration in WordPress & co.

Add the snippet in WordPress, Shopify, TYPO3, Next.js, Nuxt, Laravel and static sites.

The snippet

After creating a website under Live data, you receive an embed code:

<script src="https://turbometrics.io/tm.min.js" data-site-id="YOUR_SITE_KEY" async></script>

This script has to be in the <head> of every page that should be measured. The async attribute makes sure it does not affect load time.

WordPress

Install the turbometrics plugin straight from the WordPress directory. It embeds the tracking script automatically on all pages, reports updates for the diagnosis and shows the values in the WordPress dashboard.

  1. In WordPress, go to Plugins > Add new and search for turbometrics
  2. Click Install now, then Activate
  3. Open Settings > turbometrics and click Connect with turbometrics. You sign in (or create an account right there) and confirm the connection. It applies to this one website only and you can disconnect it at any time under Account → API & apps in Connected apps.

Connecting works on the free plan too, for scans. Live data from real visitors is available from Starter. Alternatively, you can still create an API token under Account → API & apps and enter it in the plugin settings.

Requirements, settings and everything the plugin does are described under WordPress plugin.

Option 2: functions.php

Add the following code to the functions.php of your child theme:

add_action('wp_head', function () {
    echo '<script src="https://turbometrics.io/tm.min.js" data-site-id="YOUR_SITE_KEY" async></script>';
}, 1);

The 1 as the priority makes sure the script is loaded early in the <head>.

Option 3: the “Insert Headers and Footers” plugin

  1. Install the WPCode plugin (formerly “Insert Headers and Footers”)
  2. Go to Code Snippets > Header & Footer
  3. Paste the script tag into the Header field
  4. Save

Option 4: theme settings

Many WordPress themes offer a field for header scripts under Appearance > Customizer > Additional CSS/JS or in the theme options. Add the snippet code there.

Option 5: the wp_head hook via a plugin

If you use a plugin of your own:

<?php
/**
 * Plugin Name: turbometrics Live-Daten
 */
add_action('wp_head', function () {
    echo '<script src="https://turbometrics.io/tm.min.js" data-site-id="YOUR_SITE_KEY" async></script>';
}, 1);

Save it as turbometrics.php in the wp-content/plugins/ directory and activate the plugin.

Shopify

  1. Go to Online Store > Themes > Actions > Edit code
  2. Open theme.liquid
  3. Add the script tag directly before </head>
  4. Save

TYPO3

Via TypoScript:

page.headerData.99 = TEXT
page.headerData.99.value = <script src="https://turbometrics.io/tm.min.js" data-site-id="YOUR_SITE_KEY" async></script>

Static websites / HTML

Add the script tag directly into the <head> of your HTML files:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>My site</title>
    <script src="https://turbometrics.io/tm.min.js" data-site-id="YOUR_SITE_KEY" async></script>
</head>

Next.js / React

In _app.tsx or layout.tsx:

import Script from 'next/script'

export default function Layout({ children }) {
    return (
        <html>
            <head>
                <Script
                    src="https://turbometrics.io/tm.min.js"
                    data-site-id="YOUR_SITE_KEY"
                    strategy="afterInteractive"
                />
            </head>
            <body>{children}</body>
        </html>
    )
}

Nuxt / Vue

In nuxt.config.ts:

export default defineNuxtConfig({
    app: {
        head: {
            script: [
                { src: 'https://turbometrics.io/tm.min.js', 'data-site-id': 'YOUR_SITE_KEY', async: true }
            ]
        }
    }
})

Laravel

In your Blade layout (e.g. layouts/app.blade.php):

<head>
    ...
    <script src="https://turbometrics.io/tm.min.js" data-site-id="YOUR_SITE_KEY" async></script>
</head>

Google Tag Manager

  1. Create a new tag: Custom HTML
  2. Paste the HTML:
<script src="https://turbometrics.io/tm.min.js" data-site-id="YOUR_SITE_KEY" async></script>
  1. Trigger: All Pages (or specific pages)
  2. Publish

Note: integration via Tag Manager can lead to the script being executed only after the initial load. As a result, individual metrics (above all FCP and LCP) can be missing on some page views. Embedding directly in the <head> is therefore more accurate.

Setting a release (optional)

With data-release you tie every measurement to a version of your website, for example the Git commit of your last deploy:

<script src="https://turbometrics.io/tm.min.js" data-site-id="YOUR_SITE_KEY" data-release="a1b2c3d" async></script>

Letters, digits, dot, underscore and hyphen are allowed, at most 40 characters. The snippet ignores any other value. The turbometrics plugin for WordPress sets data-release itself from version 1.1.0, so there is nothing to do there. You see the releases in the Breakdown tab of the website, see Live data dashboard.

Checking that it works

After embedding:

  1. Open your website in a normal browser (not incognito with ad blockers)
  2. Navigate through a few pages
  3. Go to Live data in turbometrics – the first measurements should appear after 1–2 minutes

If no data arrives:

  • Check the browser console for errors
  • Make sure the data-site-id value is correct
  • Check whether ad blockers or content security policies are blocking the script

Further reading