News for hackers. Stuff that matters.
Re:Show HN: Mirrorshades – Simple web analytics by chrisma0 on Monday February 20, 2017 @01:06PM (#13689442)
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');
Re:Show HN: Mirrorshades – Simple web analytics by aparks517 on Monday February 20, 2017 @03:04PM (#13690410)
Thank 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.