Page Versions

It’s often helpful for debugging to know the version of code that generated the page. A great place to add this is is by injecting build-time variables into a <meta> tag. For example, this documentation site is built with Jekyll and hosted on GitHub Pages. With this setup, we inject the version into the pages like this:

<meta name="version" content="{{ site.github.build_revision }}" >
Jekyll Github Version Injection

You can inspect the <head> of this page and see how this looks.

Then, you can pull this value into TrackJS by reading it in your Install Config:

window.TrackJS && TrackJS.install({
    token: "YOUR_TOKEN",
    version: document.querySelector("meta[name=version]").content
});
Setting page version in TrackJS
import { TrackJS } from "trackjs";

TrackJS.install({
    token: "YOUR_TOKEN",
    version: document.querySelector("meta[name=version]").content
});
Setting page version in TrackJS
window.trackJs && trackJs.install({
    token: "YOUR_TOKEN",
    version: document.querySelector("meta[name=version]").content
});
Setting page version in TrackJS