JSFiddle - React, Tailwind, and code Playground
HTML
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<div id="plusBox">
<g:plusone size="Tall" count="true" callback="plusClick" href="http://www.odditysoftware.com"> </g:plusone>
</div>
JavaScript
function plusClick(data){
// let's do something when the user clicks the +1
if(data.state=="on"){
// +1
////////////////////////////////////
// Uncomment the following line to hide the button if we get a +1
////////////////////////////////////
//$("#plusBox").hide();
////////////////////////////////////
// Track The Event In Analytics
////////////////////////////////////
if(window._gaq){
_gaq.push(['_trackEvent', 'Google-Plus-One', data.state, data.href]);
}
////////////////////////////////////
// Track The Event In Woopra
////////////////////////////////////
if(typeof woopraTracker != 'undefined'){
woopraTracker.pushEvent({name: 'Google +1', url: data.href});
}
}else if(data.state=="off"){
////////////////////////////////////
// -1 (user took their +1 Away)
////////////////////////////////////
////////////////////////////////////
// Track The Event In Analytics
// Notice in both cases were tracking data.state as a parameter that way we can segment + and -
////////////////////////////////////
if(window._gaq){
_gaq.push(['_trackEvent', 'Google-Plus-One', data.state, data.href]);
}
////////////////////////////////////
// Track The Event In Woopra
////////////////////////////////////
if(typeof woopraTracker != 'undefined'){
woopraTracker.pushEvent({name: 'Google -1', url: data.href});
}
}
}