Skip to content

Instantly share code, notes, and snippets.

@dredlong
Last active September 2, 2020 15:49
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/3aef05765c6d0535821502eb96db73c2 to your computer and use it in GitHub Desktop.
Save dredlong/3aef05765c6d0535821502eb96db73c2 to your computer and use it in GitHub Desktop.
Impact Radius tracking example
<html>
<head>
<title>Rocketship checkout</title>
<!-- Impact Radius tracking tag -->
<script type="text/javascript"> (function(a,b,c,d,e,f,g){e['ire_o']=c;e[c]= e[c]||function(){(e[c].a=e[c].a||[]).push(arguments)};f=d.createElement(b);g=d.getElementsByTagName(b)[0];f.async=1;f.src=a;g.parentNode.insertBefore(f,g);})('//d.impactradius-event.com/A000000-40b8-4537-b9b1-7e64006431fd65535.js','script','ire',document,window); </script>
<!-- End tracking tag -->
</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) {
window.localStorage.setItem("checkout_data", data);
window.location.href(thankyou_url);
}
});
}
</script>
</body>
</html>
<html>
<head>
<title>Thanks for buying!</title>
<!-- Impact Radius tracking tag -->
<script type="text/javascript"> (function(a,b,c,d,e,f,g){e['ire_o']=c;e[c]= e[c]||function(){(e[c].a=e[c].a||[]).push(arguments)};f=d.createElement(b);g=d.getElementsByTagName(b)[0];f.async=1;f.src=a;g.parentNode.insertBefore(f,g);})('//d.impactradius-event.com/A000000-40b8-4537-b9b1-7e64006431fd65535.js','script','ire',document,window); </script>
<!-- End tracking tag -->
</head>
<body>
<div id="tracker"></div>
<h1>Thank you!</h1>
<p>Thanks for purchasing Rocketship App. Your license key has been emailed to you.</p>
<script type="text/javascript">
var data = window.localStorage.getItem("checkout_data");
// Impact Radius identify tag
ire('identify', {
customerId: data.user.id,
customerEmail: data.user.email
});
var order_amount = (data.checkout.prices.vendor.total - data.checkout.prices.vendor.total_tax).toFixed(2);
// Replace the action tracker ID with the value from your Impact Radius account
ire('trackConversion', ACTIONTRACKERID, {
orderId: data.checkout.id,
customerId: data.user.id,
customerEmail: data.user.email,
orderPromoCode: data.checkout.coupon.coupon_code,
currencyCode: data.checkout.prices.customer.currency,
items: [
{
subTotal: order_amount,
category: "Product category name",
sku: data.product.id,
name: data.product.name,
quantity: data.product.quantity
}
]
},
{
verifySiteDefinitionMatch:true
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment