Skip to content

Instantly share code, notes, and snippets.

@dredlong
Created March 21, 2018 12:15
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/7a1ed55cbe08642238f1b7c4a1459057 to your computer and use it in GitHub Desktop.
Save dredlong/7a1ed55cbe08642238f1b7c4a1459057 to your computer and use it in GitHub Desktop.
Impact Radius (callback 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-button">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) {
// 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