Skip to content

Instantly share code, notes, and snippets.

@koenbok
Created January 7, 2015 10:56
Show Gist options
  • Select an option

  • Save koenbok/44c5e2769fbbc1fc9044 to your computer and use it in GitHub Desktop.

Select an option

Save koenbok/44c5e2769fbbc1fc9044 to your computer and use it in GitHub Desktop.
GoSquared FastSpring
<!-- start gosquared -->
<div>
<script>
!function(g,s,q,r,d){r=g[r]=g[r]||function(){(r.q=r.q||[]).push(
arguments)};d=s.createElement(q);q=s.getElementsByTagName(q)[0];
d.src='//d1l6p2sc9645hc.cloudfront.net/tracker.js';q.parentNode.
insertBefore(d,q)}(window,document,'script','_gs');
_gs('GSN-181913-K');
</script>
<script>
function convertUSD(value) {
console.log("convertUSD:", value);
return parseInt(value.replace(/\D+/g, '')) / 100;
};
_gs('transaction', '#{order.id}', {
revenue: convertUSD("#{order.subTotalUSD}"),
// quantity: 10,
track: true
}, [
<repeat value="#{order.allItems}" var="orderItem">
{
name: '#{orderItem.productName}',
price: convertUSD("#{orderItem.priceTotalUSD}"),
quantity: #{orderItem.quantity}
}
</repeat>
]);
</script>
</div>
<!-- end gosquared -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment