Conversion tracking code

Hi, I need to add a conversion tracking code to the swell checkout confirmation page.

I found a place to add a script for the checkout confirmation page, but I need to have access to the order object. I need to dynamically add a bunch of order-related data. I see we can use "{{ order }}" to render information but I am not too sure where I can see what data I have access to it.

Please let me know how I can add order-related data on the checkout script field, thanks!! πŸ™


  • Hello Sohee,

    The script can be included within the Settings > Checkout > Checkout Scripts section. Keep in mind that the script will need to be saved before the checkout is generated, and won't reflect while refreshing in real-time.

    ο»Ώο»ΏYou will also need to fetch the order if you want to pass this on. To retrieve those fields, you can include aΒ fetchΒ call in your script like so:

    var pathArray = window.location.pathname.split('/');
    var secondLevelLocation = pathArray[2];
    fetch('' + secondLevelLocation)
      .then(response => response.json())
      .then(data => console.log(data));

Sign In or Register to comment.