PREREQUISITE

Before getting started please have your MerchantID ready to insert into the below code. Your Project Manager will provide you with this at the start of your on boarding or replatforming. If missing you can obtain your MerchantID by reaching out to our support team at (877)-362-4556 x1 or support@listrak.com or the chat bubble in the bottom right corner of this page.

PART 1: ADD THE ONESCRIPT TO THE BOTTOM OF THE PAGE

Place this block of code above the end body tag </body> on every page on your site. Be sure to replace MERCHANTID  in the code below with your unique ID.

<!-- Listrak Analytics – Javascript Framework -->
<script type="text/javascript">
        var biJsHost = (("https:" == document.location.protocol) ? "https://" : "http://");
        (function (d, s, id, tid, vid) {
          var js, ljs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) return; js = d.createElement(s); js.id = id;
          js.src = biJsHost + "cdn.listrakbi.com/scripts/script.js?m=" + tid + "&v=" + vid;
          ljs.parentNode.insertBefore(js, ljs);
        })(document, 'script', 'ltkSDK', 'MERCHANTID', '1');
</script>

Testing Part 1

Open your website in your browser and open your browser’s console tab. (In most browsers press F12 and then click on the console tab.)

Next, in the console Type _ltk and then press enter to check to ensure the _ltk object exists. You will see the following:

PART 2: INSTALLING CONVERSION TAGS ON THE ORDER CONFIRMATION PAGE

  • Place the below code on the order confirmation page only. Make sure this code is above the Onescript code you installed in part 1.
  • Update all _ltk.Order values with the appropriate variables.
  • For _ltk.Order.AddITem iterate though all items order, one line per item ordered.
<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.AddItem('SKU-124', 1, '10.00'); // one line per item ordered
            _ltk.Order.Submit();

            /********** End Custom Code **********/
        });
</script>
  • Place this image at the top of the order confirmation page only directly after the opening <body> tag.
  • Be sure to replace the MERCHANTID with your unique ID. This is the same ID as in Part 1.
<img src="https://fp.listrakbi.com/fp/MERCHANTID.jpg" height="1" width="1" />

Testing Part 2

  1. Open your website in your browser Open up your browser’s network tab. (In most browsers press F12 and then click on the console tab.)
  2. Set the filter to ‘listrak.’

4. On your website, complete a test order.
5. When you get to your confirmation page, you will see a T.ashx request

6. Click the T.ashx request and then the headers tab.
8. Ensure the order number is there and make sure that the values match the values from your order test.

9. Next, click the Set.ashx request and then the the headers tab.
11. Ensure the order number is there and make sure that the values match the values from your order test.

Did this answer your question?