-
-
Save dredlong/42ae007b418d3d467353cdc5ff686b59 to your computer and use it in GitHub Desktop.
Webgains 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 + '¤cy=' + data.checkout.prices.vendor.currency + '&product_id=' + data.checkout.product.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 COMMISSION JUNCTION TRACKING CODE --> | |
<div id="tracker"></div> | |
<!-- END COMMISSION JUNCTION TRACKING CODE --> | |
<h1>Thank you!</h1> | |
<p>Thanks for purchasing Rocketship App. Your license key has been emailed to you.</p> | |
<script type="text/javascript"> | |
// Function to read URL parameters | |
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, currency; | |
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'); | |
} | |
if (urlParam('currency')) { | |
// Vendor default currency | |
currency = urlParam('currency'); | |
} | |
// NB. Replace CID and TYPE parameters with the correct values from your account | |
var img_src = "https://www.emjcd.com/u?AMOUNT=" + order_amount + "&CID=123456&OID=" + checkout_id + "&TYPE=789654&CURRENCY=" + currency + "&METHOD=IMG"; | |
// Load tracker pixel | |
document.getElementById('tracker').innerHTML = '<img src="' + img_src + '" height="1" width="20">'; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment