Skip to content

Instantly share code, notes, and snippets.

@mehdimehdi
Created January 17, 2013 03:26
Show Gist options
  • Save mehdimehdi/4553320 to your computer and use it in GitHub Desktop.
Save mehdimehdi/4553320 to your computer and use it in GitHub Desktop.
Reward enable Landing page (For example user coming from QR code scanning)
<!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">
<meta http-equiv="Refresh" content="300">
<style>
body {
font-family:helvetica;
}
</style>
<body>
<div id="user-disconnected" style="display:none;">
<div style="margin-top:40px;padding:5px;">Welcome!</div>
<div style="margin-top:40px;">Please connect to earn your 300 points for checking-in</div>
<center>
<button id="connect-button" style="margin-top:40px;padding:20px;width:200px;">Connect to the program</a>
</center>
</div>
<div id="user-connected" style="display:none;">
<div style="margin-top:40px;padding:5px;">Welcome back!</div>
</div>
<script type="text/javascript" charset="utf-8">
var _ptq = _ptq || [];
var _punchtab_settings = {
key: "<your key>",
language: "en",
display: "inline",
earningmap: false,
unbrand:true,
notification: 'loggedin',
activity: {visit: false},
position: {x:"right", y:"top"}
};
(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?src=wordpress';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(pt, s);
})();
</script>
<script>
window.ptReady = window.ptReady || [];
window.ptReady.push(function () {
var random_number = Math.floor(Math.random()*1000);
PT.event.bind("user.disconnected", function (response) {
document.getElementById("user-connected").style.display = "none";
document.getElementById("user-disconnected").style.display = "block";
_ptq.push(["checkin", {points: 300, ref_id:random_number}]);// this assignes points everytime you load the page
});
PT.event.bind("user.connected", function (response) {
document.getElementById("user-connected").style.display = "block";
document.getElementById("user-disconnected").style.display = "none";
_ptq.push(["checkin", {points: 300, ref_id:random_number}]);// this assignes points everytime you load the page
});
PT.widget.connect.attachConnect(PT.dom.$("connect-button"));
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment