-
-
Save dredlong/cfe1ddee45c03a92dbfd25b912ea85a7 to your computer and use it in GitHub Desktop.
HasOffers sales tracking
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Rocketship checkout</title> | |
</head> | |
<body> | |
<div class="container"> | |
<h1>Rocketship checkout</h1> | |
<p>Grab your copy of Rocketship app</p> | |
<a id="buy-button" class="btn btn-default">Buy Now!</a> | |
</div> | |
<script src="https://cdn.paddle.com/paddle/paddle.js"></script> | |
<script type="text/javascript"> | |
Paddle.Setup({ | |
vendor: 12345, // Your Paddle vendor ID | |
}); | |
document.getElementById('buy-button').addEventListener('click', openCheckout, false); | |
function openCheckout () { | |
var thankyou_url = './thankyou.html'; // Your thank you page location | |
Paddle.Checkout.open({ | |
product: 654321, // Your product or plan ID | |
successCallback: function(data) { | |
thankyou_url += '?checkout_id=' + data.checkout.id; | |
var order_amount = (data.checkout.prices.vendor.total - data.checkout.prices.vendor.total_tax).toFixed(2); | |
thankyou_url += '&order_amount=' + order_amount; | |
window.location.href(thankyou_url); | |
} | |
}); | |
} | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Thanks for buying!</title> | |
</head> | |
<body> | |
<!-- BEGIN HASOFFERS TRACKING CODE --> | |
<div id="tracker"></div> | |
<!-- END HASOFFERS TRACKING CODE --> | |
<iframe src="" scrolling="no" frameborder="0" width="1" height="1"></iframe> | |
<h1>Thank you!</h1> | |
<p>Thanks for purchasing Rocketship App. Your license key has been emailed to you.</p> | |
<script type="text/javascript"> | |
function urlParam(name) { | |
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); | |
if (results==null){ | |
return null; | |
} | |
else { | |
return decodeURI(results[1]) || 0; | |
} | |
} | |
var checkout_id, order_amount; | |
if (urlParam('checkout_id')) { | |
// Unique transaction ID | |
checkout_id = urlParam('checkout_id'); | |
} | |
if (urlParam('order_amount')) { | |
// Net sale amount in vendor default currency | |
order_amount = urlParam('order_amount'); | |
} | |
// NB. Replace offer_id parameter with the correct value from your HasOffers account | |
var iframe_src = "http://demo.go2jump.org/aff_l?offer_id=1234&conversion_unique_id=" + checkout_id + "&amount=" + order_amount; | |
// Load tracker pixel | |
document.getElementById('tracker').innerHTML = '<iframe src="' + iframe_src + '" scrolling="no" frameborder="0" width="1" height="1"></iframe>'; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment