Skip to content

Instantly share code, notes, and snippets.

@guillaumew
Last active December 17, 2015 00:49
Show Gist options
  • Save guillaumew/5524274 to your computer and use it in GitHub Desktop.
Save guillaumew/5524274 to your computer and use it in GitHub Desktop.
Track a Google Plus "+1" in Javascript
<!-- Call google plus library-->
<script src="https://apis.google.com/js/plusone.js"></script>
<!-- Insert +1 button with callback attribute -->
<div id="plusBox">
<g:plusone size="Tall" count="true" callback="track_googleplus">
</g:plusone>
</div>
<!-- Add Javascript Callback function -->
<script type="text/javascript">
function track_googleplus(data){
if(data.state=="on"){
alert('ok');
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment