Analytics Conversion Tracking | Comecero Documentation
If you want to inject custom conversion code that runs when a customer successfully completes an order, you can supply custom JavaScript to run on the receipt / confirmation page of a storefront app.
Your custom JavaScript will have access to three key variables:
These variables hold the order, payment and customer objects for the completed order and you can access any of the properties within these objects. Naturally, because this code is running within a client-side environment, the objects will only have properties that are accessible to Limited tokens.
Important Note! You can provide JavaScript but not HTML that contains JavaScript. If the code you provide contains elements such as <script> then that is HTML and is NOT valid tracking code. Your supplied tracking code must contain pure JavaScript only.
Here's an example of JavaScript that loads a tracking pixel:
var img = document.createElement("img");
img.src = "https://track.example.com/load.png?order_id=" + order.order_id + "&total=" + order.total + "&email=" + customer.email;
var body = document.getElementsByTagName("body")[0];
body.appendChild(img);