-
-
Save kwokaaron/bfd06991e90e157c5e5d28e68f863aa5 to your computer and use it in GitHub Desktop.
ShareASale (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> | |
<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() { | |
Paddle.Checkout.open({ | |
product: 654321, // Your product or plan ID | |
successCallback: track_conversion | |
}); | |
} | |
function track_conversion(data) { | |
var sas_mid = 12345, // Your ShareASale Merchant ID | |
order_amount = (data.checkout.prices.vendor.total - data.checkout.prices.vendor.total_tax).toFixed(2), | |
sas_img = new Image(); | |
sas_img.id = "_SHRSL_img_1"; | |
sas_img.src = "https://shareasale.com/sale.cfm?v=paddle1.0&merchantid=" + sas_mid + "&amount=" + order_amount + "&tracking=" + data.checkout.id + "&skulist=" + data.product.id + "&pricelist=" + order_amount / data.product.quantity + "&quantitylist=" + data.product.quantity + "&couponcode=" + data.checkout.coupon.coupon_code + "¤cy=" + data.checkout.prices.customer.currency; | |
sas_img.width = 1; | |
sas_img.height = 1; | |
document.body.appendChild(sas_img); | |
} | |
</script> | |
<script src="https://www.dwin1.com/19038.js" type="text/javascript" defer="defer"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment