Tutorial Add Data Attribute of User Agent
var b = document.documentElement; b.className = b.className.replace('no-js','js'); b.setAttribute("data-useragent"...

https://iskablogs.blogspot.com/2014/03/tutorial-add-data-attribute-of-user.html
var b = document.documentElement;
b.className = b.className.replace('no-js','js');
b.setAttribute("data-useragent", navigator.userAgent);
b.setAttribute("data-platform", navigator.platform );
Which results in data attributes being added to the html element like:
data-useragent="Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR
b.className = b.className.replace('no-js','js');
b.setAttribute("data-useragent", navigator.userAgent);
b.setAttribute("data-platform", navigator.platform );
Which results in data attributes being added to the html element like: