Skip to content

Install via CDN / script tag

This page is for pages with no build step. If you use a bundler, install from npm instead (see the connector overview): your bundler connects Uptimizr to your engine, no globals are involved, and nothing on this page applies.

Without a bundler, each connector ships two standalone files. Neither contains the engine: both use the copy your page already runs. Pick by how your page loads code:

Your page Use Adds to window
ES modules (<script type="module">), as three.js and Babylon Lite pages are The ESM bundle with an import map Nothing
Classic <script> tags, as Babylon.js, PlayCanvas and A-Frame pages usually are The global bundle Uptimizr, and nothing else
Connector Bundle file Global exposed
Babylon.js uptimizr-babylon.global.js window.Uptimizr
Babylon Lite uptimizr-babylon-lite.global.js window.Uptimizr
three.js uptimizr-three.global.js window.Uptimizr
PlayCanvas uptimizr-playcanvas.global.js window.Uptimizr
A-Frame uptimizr-aframe.global.js window.UptimizrAframe (registers the uptimizr component)
Replay uptimizr-replay.global.js window.UptimizrReplay
Unity uptimizr-unity.global.js window.UptimizrUnity (trackUnity)
Godot uptimizr-godot.global.js window.UptimizrGodot (trackGodot)
Unreal uptimizr-unreal.global.js window.UptimizrUnreal (trackUnreal)

The standalone bundle is just a static file, so serve it however you like:

  • From a public npm CDN — because the connectors are published to npm, a CDN like jsDelivr or unpkg can serve the bundle straight from the package:

    <script src="https://cdn.jsdelivr.net/npm/@uptimizr/babylon/dist/uptimizr-babylon.global.js"></script>
    <!-- or pin a version: .../npm/@uptimizr/babylon@0.1.0/dist/uptimizr-babylon.global.js -->
  • From your own static host — self-host the file (any static host, object store, or CDN works) and point the <script> at it. The collector does not serve it. The local playground does, at /uptimizr-babylon.global.js.

On a page that already uses ES modules, import Uptimizr as a module too. An import map points Uptimizr at the same engine your page imports, so there is one copy of the engine and nothing goes on window.

Connector ESM bundle Import map entry
three.js uptimizr-three.js three
Babylon Lite uptimizr-babylon-lite.js @babylonjs/lite
PlayCanvas uptimizr-playcanvas.js playcanvas

Keep one URL per engine: map it once and import it by name everywhere, or the page ends up with two copies. Pin the version to one the connector supports. See the three.js and Babylon Lite tabs under Usage.

The global bundle stays engine-free, so it looks your engine up on a global the first time it needs it. Classic engine scripts set that global themselves, so there is nothing for you to add:

Bundle Engine global Who sets it
Babylon.js none, it reads the scene you pass nothing to do
three.js window.THREE nothing official: three.js has no global build, so use the ESM bundle
A-Frame window.THREE or AFRAME.THREE aframe.min.js
PlayCanvas window.pc the classic PlayCanvas script
Babylon Lite window.BabylonLite nothing: Lite is ESM-only, so use the ESM bundle

Load order doesn’t matter for that lookup. Loading the bundle never touches the engine, so it can come before or after the engine script, and the global only has to exist by the time you call trackScene. The exception is A-Frame: load its bundle after aframe.min.js, because the bundle registers the uptimizr component as it loads.

If the global is missing, trackScene throws an error saying what to do, before any session starts. The bundle itself still loads.

Call trackScene once the engine scene exists. On a classic page, injecting the script through the DOM also sidesteps any TypeScript/import rewriting on the host page:

<script>
const s = document.createElement("script");
s.src = "https://cdn.jsdelivr.net/npm/@uptimizr/babylon/dist/uptimizr-babylon.global.js";
s.onload = () => {
Uptimizr.trackScene(scene, {
projectId: "your-project-id",
endpoint: "https://collect.example.com",
meta: { sceneId: "playground" },
});
};
document.head.appendChild(s);
</script>

trackScene(...) returns the same client as the npm path from either bundle, so you can read client.sessionId, emit custom events with client.track(...), change scenes with client.setScene(...), and client.stop() — everything in the configuration reference works identically.

The replay bundle exposes window.UptimizrReplay with a one-call replayInScene helper — see the session replay guide.