Blue Tracely Install Guide for TypeScript

Add the Blue Tracely snippet to a TypeScript website, either in its HTML template or from a small typed loader, without rewriting the snippet.

This guide shows how to add the Blue Tracely snippet to a website written in TypeScript. You don't need to convert the snippet to TypeScript: it's a plain <script> tag that runs in the browser as it is.

Before you begin

The Add the script to your HTML page, with the snippet and its Copy button

A TypeScript site still serves HTML pages. Paste the snippet, unchanged, just before the closing </head> tag of your HTML template or shared layout, then build and deploy. See Blue Tracely Install Guide for Your Website via Code.

Option 2: A typed loader

If your pages are built from TypeScript and you can't edit the HTML, add the snippet's code from a small module that runs once when your site starts. Use only the code between <script> and </script> from your snippet, unchanged:

// blue-tracely.ts
const BLUE_TRACELY_SNIPPET: string = `/* Paste the code between <script> and </script> from your snippet here */`;

export function loadBlueTracely(): void {
	if (document.getElementById("blue-tracely")) return;
	const script: HTMLScriptElement = document.createElement("script");
	script.id = "blue-tracely";
	script.text = BLUE_TRACELY_SNIPPET;
	document.head.appendChild(script);
}

Call loadBlueTracely() once from your site's entry point, then compile and deploy as usual. The snippet's code contains no backticks, so it fits inside the template literal as it is.

Don't rewrite the snippet or replace it with a tag that loads the script file directly. The snippet sets things up before the file loads, and without it Test script reports that your website is running a different version of the script.

Pages that change without reloading

The script reports one page view per full page load. If your site changes pages in the browser without loading a new page, only the first page a visitor loads is reported. See Single Page vs. Multi-Page Sites: A Data Collection Perspective.

Check the installation

Open your live site, then go back to the Script page and select Test script next to your domain. When the script answers, you'll see "The script is installed on your website." See Verifying Your Script Installation.