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 |
Bundles & globals
Section titled “Bundles & globals”| 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) |
Where to load it from
Section titled “Where to load it from”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.
ES modules with an import map
Section titled “ES modules with an import map”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.
How the global bundle finds your engine
Section titled “How the global bundle finds your engine”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><script type="importmap"> { "imports": { "@babylonjs/lite": "https://cdn.jsdelivr.net/npm/@babylonjs/lite@1.38.1/dist/index.js" } }</script><script type="module"> import * as BabylonLite from "@babylonjs/lite"; import { trackScene } from "https://cdn.jsdelivr.net/npm/@uptimizr/babylon-lite/dist/uptimizr-babylon-lite.js";
// ...create engine, scene and camera... // Lite has no active camera, so pass camera + canvas explicitly. trackScene(scene, camera, canvas, { projectId: "your-project-id", endpoint: "https://collect.example.com", });</script><script type="importmap"> { "imports": { "three": "https://cdn.jsdelivr.net/npm/three@0.187.0/build/three.module.js" } }</script><script type="module"> import * as THREE from "three"; import { trackScene } from "https://cdn.jsdelivr.net/npm/@uptimizr/three/dist/uptimizr-three.js";
// ...create scene, camera, renderer... // three has no active camera, so pass camera + renderer explicitly. trackScene(scene, camera, renderer, { projectId: "your-project-id", endpoint: "https://collect.example.com", });</script><script src="https://code.playcanvas.com/playcanvas-stable.min.js"></script><script src="https://cdn.jsdelivr.net/npm/@uptimizr/playcanvas/dist/uptimizr-playcanvas.global.js"></script><script> // ...create app + a camera entity... Uptimizr.trackScene(app, cameraEntity, { projectId: "your-project-id", endpoint: "https://collect.example.com", });</script><head> <script src="https://aframe.io/releases/1.7.1/aframe.min.js"></script> <!-- Load AFTER A-Frame: it registers the `uptimizr` component. --> <script src="https://cdn.jsdelivr.net/npm/@uptimizr/aframe/dist/uptimizr-aframe.global.js"></script></head><body> <a-scene uptimizr="projectId: your-project; collector: https://collect.example.com"> <a-box position="0 1 -3" color="#4db4e6"></a-box> </a-scene></body>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.
Replay from a script tag
Section titled “Replay from a script tag”The replay bundle exposes window.UptimizrReplay with a one-call replayInScene helper — see the
session replay guide.