-
-
Save dredlong/08642dc422e68abd61f3f80b8bcd0c05 to your computer and use it in GitHub Desktop.
Tapfiliate (callback example)
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> | |
<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