INSTALLING YOUR CART COLLECTIONS CODE

To make sure we have the latest shopping cart information, it is very important to receive the JavaScript call every time the shopper has the ability to modify the cart contents. Every time Listrak receives this call, the cart will be recreated from scratch, so it is also important to ensure that every update contains the full cart feed.

  • NOTE: This is not an incremental process. You should not send us just what was added or removed to the cart, but every time an item is added or removed from the cart, you should send us the full cart contents.
  1. Each time an item is added to the cart, send us the entire cart contents.
  2. Update the JavaScript and add the AddItemsWithLinks function for each item that is in the customer’s cart.
  3. Replace the following variables: sku, number, price, product, images, and link.
<script type="text/javascript">
        (function(d) { if (document.addEventListener) document.addEventListener('ltkAsyncListener', d);        else {e = document.documentElement; e.ltkAsyncProperty = 0; e.attachEvent('onpropertychange', function (e) {
        if (e.propertyName == 'ltkAsyncProperty'){d();}});}})(function() {
            /********** Begin Custom Code **********/

              _ltk.SCA.AddItemWithLinks('sku1', 1, '19.95', 'prod 1', '/images/product1.jpg', '/product1.html');
              _ltk.SCA.AddItemWithLinks('sku2', 1, '29.95', 'prod 2', '/images/product2.jpg', '/product2.html');
              _ltk.SCA.AddItemWithLinks('sku3', 2, '39.95', 'prod 3', '/images/product3.jpg', '/product3.html');
              _ltk.SCA.Submit();

            /********** End Custom Code **********/
        });
</script>

TESTING YOUR CART COLLECTION CODE

  1. Open your website in your browser.
  2. Open up your browser’s network tab.
  • NOTE: Press F12 in certain browsers and then click on the Network Tab.

3. If possible, set the filter to ‘listrak’.

4. Add an item to your cart.
5. You should see an update?gsid request fire when you have added the item to your cart.
6. Click the update?gsid request.
7. Click the Headers Tab.
8. Scroll down and ensure that the item in the update?gsid request is the same item that you put in your cart.

9. Add a second item to your cart and ensure that when you click on the update?gsid request this time, you see both items, and not just the most recent. Again, you should be sending the full cart contents every time an item is added or removed from a cart.

10. Browse to your cart page and remove an item from your cart, when the update?gsid request fires, you should only see one item in the call instead of two.

INSTALLING THE CLEAR CART CODE

For example, ensure this call is fired when a customer clicks the clear cart button on your cart page. Another example might be if a customer sets all the item quantities in their cart to zero. Essentially, any time a customer’s cart can be cleared out, this call should be fired. 

  1. Whenever the cart is cleared, send us this snippet of JavaScript:_ltk.SCA.ClearCart();
  <script type="text/javascript">       
        (function(d) { if (document.addEventListener) document.addEventListener('ltkAsyncListener', d);        else {e = document.documentElement; e.ltkAsyncProperty = 0; e.attachEvent('onpropertychange', function (e) {
        if (e.propertyName == 'ltkAsyncProperty'){d();}});}})(function() {
            /********** Begin Custom Code **********/

              _ltk.SCA.ClearCart();

            /********** End Custom Code **********/
        });
</script>

TESTING THE CLEAR CART CODE

1. Open your website in your browser.
2. Open up your browser’s network tab.

  • NOTE: Press F12 in certain browsers and then click on the Network Tab.

3. If possible, set the filter to ‘listrak.’

4. Add an item to your cart.
5. You should see a update?gsid=... request fire when you have added an item to your cart.
6. Go to your cart page and remove all the items in your cart.
7. You should see another update?gsid=... request fire.
8. Click the new update?gsid=... request.
9. Click the headers tab.
10. You should now see where cc = true. This means clear cart = true.

SETTING UP EMAIL ADDRESS ABANDONER CAPTURE CODE

The abandoner email capture code allows Listrak to capture when site visitors type in their email address into any email address field—even if they abandon the transaction or leave the site.

  1. Add the following call for every field that a customer is able to fill out their email address.
  2. Replace Email Field ID below with the ID of the field the customer is able to type their email address into.
    <script type="text/javascript">    
        (function(d) { if (document.addEventListener) document.addEventListener('ltkAsyncListener', d);        else {e = document.documentElement; e.ltkAsyncProperty = 0; e.attachEvent('onpropertychange', function (e) {
        if (e.propertyName == 'ltkAsyncProperty'){d();}});}})(function() {
            /********** Begin Custom Code **********/

            _ltk.SCA.CaptureEmail('Email Field ID');

            /********** End Custom Code **********/

        });

</script>

INSTALLING THE SCA CONVERSION TRACKING CODE

When a shopper’s transaction is complete, we need to ensure that we capture the order and transmit it to Listrak properly so we can ensure abandoners who have purchased are removed from the Cart Abandonment campaign correctly.

1. Place the below code on the order confirmation page only. This code should go below the _ltk.Order code you originally placed on the confirmation page.
2. Update all _ltk.SCA values with the appropriate variables.

<script type="text/javascript">
        (function(d) { if (document.addEventListener) document.addEventListener('ltkAsyncListener', d);        else {e = document.documentElement; e.ltkAsyncProperty = 0; e.attachEvent('onpropertychange', function (e) {
        if (e.propertyName == 'ltkAsyncProperty'){d();}});}})(function() {
            /********** Begin Custom Code **********/
             /** Handle ORDER **/
            _ltk.Order.SetCustomer('customer@email.com', 'FirstName', 'LastName');
            _ltk.Order.OrderNumber = '10025736';
            _ltk.Order.ItemTotal = '25.00';
            _ltk.Order.ShippingTotal = '6.99';
            _ltk.Order.TaxTotal = '1.50';
            _ltk.Order.HandlingTotal = '0.50';
            _ltk.Order.OrderTotal = '33.99';
            _ltk.Order.AddItem('SKU-123', 3, '5.00'); // one line per item ordered
            _ltk.Order.Submit();

            _ltk.SCA.SetCustomer('customer@domain.com', 'John', 'Smith');
            _ltk.SCA.OrderNumber = '10025736';
            _ltk.SCA.Submit();

            /********** End Custom Code **********/
        });
</script>

 

Did this answer your question?