4 ms·
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[script
by chrisma0 10y ago
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');
- aparks517 10y agoThank you! This was very helpful feedback. I added the async attribute to the script tag late in the game and didn't think about how it would interact with this. I've updated the agent script with a more robust method of finding the site ID and am deploying it now.