Skip to content

Instantly share code, notes, and snippets.

@firedfox
Created August 28, 2012 06:51
Show Gist options
  • Save firedfox/3495646 to your computer and use it in GitHub Desktop.
Save firedfox/3495646 to your computer and use it in GitHub Desktop.
holmes-im-looyu-0
(function() {
var REQUEST_PATH = '/virtual/im/';
var REQUEST_NAME = ['center', 'left-sum'];
var GET_ITEMS = function() {
return [
document.getElementById('doyoo_mon_accept'),
document.getElementById('ncontent')
];
};
window._hmt = window._hmt || [];
var on = function(elem, event, handler) {
if (elem.addEventListener) {
elem.addEventListener(event, handler, false);
} else if (elem.attachEvent) {
elem.attachEvent('on' + event, handler);
}
};
var track = function(item, i) {
on(item, 'mouseup', function() {
window._hmt.push(['_trackPageview', REQUEST_PATH + (REQUEST_NAME[i] || i + 1)]);
});
};
on(window, 'load', function() {
var items = GET_ITEMS();
for (var i = items.length - 1; i >= 0; i--) {
items[i] && track(items[i], i);
}
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment