Skip to content

Instantly share code, notes, and snippets.

@nickgartmann
Created March 5, 2014 17:31
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nickgartmann/9372077 to your computer and use it in GitHub Desktop.
Save nickgartmann/9372077 to your computer and use it in GitHub Desktop.
A bookmarklet for setting the favicon of google analytics to the number of people currently on your site. (Will break not update if not navigated to the real time page - I suggest leaving it sit as a pinned tab)
javascript:var thing=function(){var e=parseInt(document.getElementById("ID-overviewCounterValue").innerText);[].slice.call(document.querySelectorAll("link[type='image/x-icon']")).forEach(function(e){e.parentNode.removeChild(e)});var t=document.createElement("canvas");t.width=16;t.height=16;var n=t.getContext("2d");var r=function(){n.font="bold 10px sans-serif";n.fillText(e,e>9?2:4,12);var r=document.createElement("link");r.type="image/x-icon";r.rel="shortcut icon";r.href=t.toDataURL("image/x-icon");document.getElementsByTagName("head")[0].appendChild(r)};r()};setInterval(thing,1e3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment