JSFiddle - React, Tailwind, and code Playground

by hslincoln

JavaScript

$(document).ready(function () {
    // Define unit price
    var ORfirstrow = $('.wizrtable tbody').children('tr:first');
    var ORfirstprice = $(ORfirstrow).find('.priceeach').text().replace(/\u00A3/g, '');
    var ORsecondrow = $('.wizrtable tbody').children('tr:nth-child(2)');
    var ORsecondprice = $(ORsecondrow).find('.priceeach').text().replace(/\u00A3/g, '');
    var ORthirdrow = $('.wizrtable tbody').children('tr:last');
    var ORthirdprice = $(ORthirdrow).find('.priceeach').text().replace(/\u00A3/g, '');
    // END: Define unit price

    // Define 'item IDs' (SKUs) for each product
    var ORfirstSKU = $(ORfirstrow).find('.sku').text().replace("Product Code:", "");
    var ORsecondSKU = $(ORsecondrow).find('.sku').text().replace("Product Code:", "");
    var ORthirdSKU = $(ORthirdrow).find('.sku').text().replace("Product Code:", "");
    // END: Define item IDs for each product

    // Define item quantities
    var ORfirstQTY = $(ORfirstrow).find('.quantity').text();
    var ORsecondQTY = $(ORsecondrow).find('.quantity').text();
    var ORthirdQTY = $(ORthirdrow).find('.quantity').text();
    // END: Define item IDs for each product
    
    });

//END JS for push into Criteo API

window.criteo_q = window.criteo_q || [];
window.criteo_q.push( 
        { event: "setAccount", account: 1185 },
        { event: "setSiteType", type: "d" },
        { event: "trackTransaction" , id: "#Transaction Id#", item: [ 
              { id: "#First item id#", price: #First item unit price#, quantity: #First item quantity# },
              { id: "#Second item id#", price: #Second item unit price#, quantity: #Second item quantity# } 
              /* #add a line for each item in the user's cart# */
]});