Given a DOM node, return a unique CSS selector matching only that element. This is particularly useful when tracking in custom variables in analytics:
document.addEventListener('click', function(event) {
var selector = unique(event.target);
_gaq.push(['_trackEvent', 'Engagement', 'Click', selector]);
}, false);
component install ericclemmons/unique-selector
$ npm install
$ make
$ open test/index.html
-
v0.0.3
- Add support for various
<form>
elements (#2)
- Add support for various
-
v0.0.2
- Fix bug with
nth-child
calculation
- Fix bug with
-
v0.0.1
- Initial release
MIT