Acquire and Send Session Data to 3rd Party

CheckoutChamp connects natively with several Ad tracking platforms, however you may find the need to run a script on your page which will grab order data from the session which can then be sent out to a 3rd party from the page itself.

The order’s session data will be stored within the orderData Object.

Here is an example script which will check the orderData Object for the order’s total amount:

<script>
var orderDataTmp = JSON.parse(sessionStorage.getItem("orderData"));
if(orderDataTmp) {
  //fetch your needed values from orderDataTmp.  Investigate orderData in session storage for all values.
  //Here are 2 examples
  //orderTotal: orderDataTmp.totalAmount
  //orderId: orderDataTmp.orderId
}
</script>

The script above should be added to the top of the HTML in every page that your 3rd party tracking script has been added to. The script provided by the 3rd party will likely contain some values that need to be replaced so that the proper value is sent out. Those values will need to be replaced with values that represent what the tracking platform is wanting to see. The value inserted should always start with “orderDataTmp.” and will finish with the name of the value found within the orderData Object.

  • If the tracking script wants you to include the orderId, you will want to replace the existing value in the script with orderDataTmp.orderId

  • If the tracking script wants you to include the orderTotal, you will want to replace the existing value in the script with orderDataTmp.totalAmount

Expand to see the more common orderData values that might be sent to a 3rd Party:

Expand for instructions on viewing the orderData Object within Inspect Element tool:

Open the Inspect Element tool and place a sale on your checkout page. Then, while still in the session, open the Application menu within the Inspect Element tool, open the Session storage for your site, and then click on orderData to reveal all the data that is available.