Neat! agent.js initially failed on my site, as it wasn't the last script on the page and siteId was set to null (line 14):
var siteId = scriptElements[scriptElements.length - 1].getAttribute('data-siteId');
Maybe that could be better documented?Alternatively a change in the way that the script element (and the siteId) is detected could be helpful (instead of lines 13, 14):
var siteId = document.querySelector('script[data-siteId]').getAttribute('data-siteId');