Skip to content

Instantly share code, notes, and snippets.

@dredlong
Last active March 12, 2018 11:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dredlong/08642dc422e68abd61f3f80b8bcd0c05 to your computer and use it in GitHub Desktop.
Save dredlong/08642dc422e68abd61f3f80b8bcd0c05 to your computer and use it in GitHub Desktop.
Tapfiliate (callback example)
<html>
<head>
<title>Rocketship checkout</title>
</head>
<body>
<script src="//static.tapfiliate.com/tapfiliate.js" type="text/javascript" async></script>
<script type="text/javascript">
(function(t,a,p){t.TapfiliateObject=a;t[a]=t[a]||function(){
(t[a].q=t[a].q||[]).push(arguments)}})(window,'tap');
tap('create', 'YOUR ACCOUNT ID');
tap('detect');
function track_conversion(data) {
var order_amount = (data.checkout.prices.vendor.total - data.checkout.prices.vendor.total_tax).toFixed(2);
tap('conversion', data.checkout.id, order_amount );
}
</script>
<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>
Paddle.Setup({
vendor: 12345, // Your Paddle vendor ID
});
document.getElementById('buy-button').addEventListener('click', openCheckout, false);
function openCheckout () {
Paddle.Checkout.open({
product: 654321, // Your product or plan ID
successCallback: track_conversion
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment