chexton
2/14/2013 - 2:56 AM

basic-cart-abandonment.php

basic-cart-abandonment.php

<!-- 1. This goes in the header, it automatically tracks any customer who is logged in. -->
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()) {
  $email = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
?>
<script>
  _veroq.push(['user', {id: '<?php echo $email; ?>', email: '<?php echo $email; ?>'}]);
</script>
<?php } ?>



<!-- 2. On first page of the checkout (i.e. begin checkout - https://www.modelco.com.au/checkout/onepage/) -->
<script>
  $('#billing-buttons-container button').click(function(e){
    var email = document.getElementById('billing:email').value;
    _veroq.push(['user', {id: email, email: email}]);
  });
</script>



<!-- 3. Also on the onepage template -->
<script>
  var products = [fill-array-with-magento-products] // Here is an example: https://gist.github.com/chexton/4950379
  _veroq.push(['track', 'begins checkout', {products: <?php echo products ?>});
</script>



<!-- 4. On the thank you page -->
<script>
  _veroq.push(['track', 'completes checkout']);
</script>