Skip to content

Instantly share code, notes, and snippets.

@mehdimehdi
Created April 11, 2012 04:04
Show Gist options
  • Save mehdimehdi/2356777 to your computer and use it in GitHub Desktop.
Save mehdimehdi/2356777 to your computer and use it in GitHub Desktop.
Reward enable linked share button
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="js/libs/modernizr-2.0.6.min.js"></script>
</head>
<body>
<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
<div id="container">
<h2>This page has only one goal : show how to reward-enable a linked-in share button</h2>
<div style="width:100%;height:500px;line-height:600px;text-align:center;">
<!-- this is a typical linked share button -->
<script type="IN/Share" data-url="http://www.punchtab.com" data-counter="right" data-onsuccess="linkedinsuccess"></script>
<!-- the linkedinsuccess in the data-onsuccess attribute is the function which will be called when the user successfully share on linkedin -->
</div>
</div> <!--! end of #container -->
<!--- function which will be called after the share on linked is successful -->
<script>
function linkedinsuccess(){
// calling the PUNCHTAB JS SDK
_ptq.push(['share',{points:200}]);//rewarding for 200 points
}
</script>
<script type="text/javascript" charset="utf-8">
var _ptq = _ptq || [];
var _punchtab_settings = {
key: "YOUR KEY",
display: "tab",
position: {x:"left", y:"bottom"}
};
(function() {
var pt = document.createElement('script'); pt.type = 'text/javascript'; pt.async = true;
pt.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'static.punchtab.com/js/pt.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(pt, s);
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment