Knowledge base
Video tutorials
Try searching for:
Recently viewed articles:

Table of contents

Custom tracking code on the Order Confirmation page

If you are running an advertising campaign, or you’ve set up an affiliate marketing program using a third-party service, you can measure the results by adding the conversion tracking code provided by that company to your store. Tracking codes are typically installed on the Order Confirmation page – the last page which shoppers see after placing their orders.

To start tracking conversions get the tracking code from the affiliate or third-party service you want to use, add variables supported by Ecwid to that code, and paste it to the special section in your Ecwid admin, in the Setting → General → Tracking & Analytics page.

Modifying custom codes will require programming knowledge. Ecwid’s Custom Development team can help you with this task or build an integration between your Ecwid store and the third-party service you want to use. Get a quote.

Adding a custom tracking code to your Ecwid store

Usually affiliate or advertising services require that you paste their tracking script to the Order Confirmation page of the shopping cart. The Order Confirmation page is the page where buyers see the “Thank you for your order” message after placing their orders; its URL ends with /checkout/order-confirmation.

There is a special section in the Ecwid admin panel where you can put such a pixel code, and it will be executed every time a buyer reaches the Order Confirmation page.

If you want to pass on order details via a tracking code, you should first add Ecwid variables to your tracking code and then add the updated code to your store.

To insert a third-party tracking code in the Order Confirmation page of your Ecwid store:

  1. From your Ecwid admin, go to Settings → General → Tracking & Analytics.
  2. Scroll down to the Custom tracking code on Order Confirmation page section and click the toggle. You will see a pop-up:


  1. Add your custom code in the Custom tracking code on Order Confirmation page box in the pop-up. If you need to add several codes, paste them one after another in this area.
  2. Click Save.

Once added, your tracking code will be executed each time a customer reaches the Order Confirmation page in your store.

You can also use Google Analytics, Facebook Pixel, Pinterest Tag, Snap Pixel, or Google Ads Tags by simply pasting their ID/pixel/tag/snippet in the appropriate fields in the Ecwid admin panel, Settings → General → Tracking & Analytics.

Adding Ecwid variables to a custom tracking code

If you need to pass order details onto a tracking service, you will need to modify their tracking code by adding variables that are supported in Ecwid. These are the same variables that you can see in the Ecwid email templates. See the full list of available variables.

You can insert HTML and Javascript codes into the Order Confirmation page — Ecwid variables will work with both types of code. However, there is a slight difference in how you should paste the variables into these codes.


When you use an HTML custom code, you will need to paste the variables in it "as is":
${}, ${}, ${order.number}, etc.

Here is an example of how these variables will look in an HTML code:

<img src="${order.number}&amount=${}" />


When you use a Javascript tracking code, you will need to add the following to your code (along with the variables):

1. Surround your code with the <#noescape> tags so that the data is passed on in the correct format:



Here is an example of how these variables will look in a Javascript code:

<#list order.items as orderItem>
console.log("Item price is ${orderItem.price}")

2. Add ?js_string to the variables that pass a text. For example, you will need to use ?js_string with variables like ${} and ${}. Yet you don’t need to add it to variables that pass numbers, like order total and order number.

Here is an example of how these variables will look in a Javascript code:

"order_id": "${order.number}",
"email": "${}",
"delivery_country": "${order.billingAddress.countryCode?js_string}"

If you’ve already been using a tracking code in your Ecwid store, your tracking code may contain such variables as %order_subtotal%, %order_total%, and %order_id%. These variables are still supported, but you may modify your code to add new variables in order to pass on more order details via your tracking code.
Was this article helpful?

Awesome! Thanks for your feedback!

Thanks for your feedback!

Sorry about that! What went wrong?
18 out of 32 found this helpful
We use cookies and similar technologies to remember your preferences, measure effectiveness of our campaigns, and analyze depersonalized data to improve performance of our site. By choosing «Accept», you consent to the use of cookies.
Accept cookies Decline