Hi. How can we help?

Adding custom tracking codes to your Lightspeed eCom online store

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 Lightspeed eCom (E-Series) online 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 eCom to that code, and paste it to the special section in your Retail POS (X-Series).

Modifying custom codes will require programming knowledge. You can hire a developer or ask someone from your IT team.

Adding a custom tracking code to your online 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 Retail POS 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 eCom variables to your tracking code and then add the updated code to your online store.

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

  1. From Retail POS, go to Online > Settings > General > Tracking & Analytics.

    Navigating the Tracking & Analytics tab

  2. Scroll down to the Custom tracking code on Order Confirmation page section and click the toggle. You will see a pop-up:

    Adding custom tracking code

  3. 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.
  4. Click Save.

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

You can also use Google Analytics, Facebook (Meta) Pixel, Pinterest Tag, Snap Pixel, or Google Ads Tags by simply pasting their ID/pixel/tag/snippet in the appropriate fields in the Online tab > Settings > General > Tracking & Analytics in your Retail POS.

Adding eCom 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 eCom. These are the same variables that you can see in the eCom email templates. See the full list of available eCom (Ecwid) variables.

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

HTML

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

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

<img src="https://tracking_pixel.com?order-id=${order.number}&amount=${order.total}" />

Javascript 

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:

<script>
<#noescape>

</#noescape>
</script>

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

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

2. Add ?js_string to the variables that pass a text. For example, you will need to use ?js_string with variables like ${customer.name} and ${orderItem.name}. 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": "${customer.email?js_string}",
"delivery_country": "${order.billingAddress.countryCode?js_string}"

If you’ve already been using a tracking code in your eCom 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?