JSFiddle - React, Tailwind, and code Playground
by Ronny
HTML
<a href="http://www.google.com/" rel="external" data-report="Search/Oragnic Search Click" data-config="{
hip: true,
reports: 5
}">This link sends report just before going thru</a>
JavaScript
// https://gist.github.com/759332#gistcomment-17217
$$('[data-report]').addEvent('click', function(){
console && console.log(this.get('data-report'));
});
$$('[data-config]').addEvent('click', function(){
var config = this.get('data-config');
try {
var c = JSON.decode(config);
console && console.log(c);
} catch(e){
console && console.error('data-config attribute contains invalid JSON', config);
}
});
$$('a[rel=external]').set('target', '_blank');