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 }}" >
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
});
import { TrackJS } from "trackjs";
TrackJS.install({
token: "YOUR_TOKEN",
version: document.querySelector("meta[name=version]").content
});
window.trackJs && trackJs.install({
token: "YOUR_TOKEN",
version: document.querySelector("meta[name=version]").content
});