Go to Cratejoy admin panel: https://my.cratejoy.com/
Then go to "Design", select "Published design" -> "Code":
Then select template "html\customer\thank_you.html":
Put the following code between sections {{ carthook_thankyou }} and {% endblock %}, then press "Save" button:
Tracking pixel for Cratejoy
<!--S.L.I.C.E. Digital tracking pixel :: Begin-->
{% for p in order.products %}
<script language="JavaScript" type="text/javascript">
var afid = '{{ order.id }}'; // (required) unique order or sale ID
var afgoal = 'sale'; // (required) goal name. Can be 'lead', 'sale' or anything else
var afprice = '{{ order.total*0.01 }}'; // (required) total order sum. Sale programs - required, lead programs - optional
var afsecure = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'; // (required) security hash provided by S.L.I.C.E. Digital manager
var afcurrency = 'USD'; // (optional) checkout currency (USD, EUR, GBP, NZD, AUD, etc.)
var afua = ''; // (optional) user-agent
var afcomment = 'Products: [{% for p in order.products %}{id: {{ p.id }}, name: {{ p.instance.name }}, sku: {{ p.instance.sku }}, category: {% if p.instance.product.is_ecom %}shop_product {{ p.instance.category }}{%else%}subscription{%endif%}, price: {{ p.price | currency }}, quantity: {{ p.quantity }} }, {% endfor %}]'; // (optional) any comments for this order
</script>
<script language="JavaScript" type="text/javascript" src="//click.domain.name/track.js"></script>
{% endfor %}
<!--S.L.I.C.E. Digital tracking pixel :: End-->
Cratejoy documentation