Once you have set up your affiliate program with Affilae, you have to add tracking codes on your website, to track all sales from your affiliates.

To add Affilae tracking codes with Cratejoy, please, follow these steps:
➜  If you are using redirect tracking, go to step 2.



  Track clicks


In your Cratejoy dashboard, go to “design” > click “code” next to your theme > Select the base.html template.

Add the following code just after the <body>tag at the top of the file

Example :

<script type="text/javascript">
    var _ae = {
    (function() {
        var element = document.createElement('script'); element.type = 'text/javascript'; element.async = true;
        element.src = '//';
        var scr = document.getElementsByTagName('script')[0]; scr.parentNode.insertBefore(element, scr);

Be carful! Remember to replace PROGRAM_ID with your PROGRAM_ID (retrieve it in your account, menu “config” > “tracking”). Please make sure that your PROGAM_ID is between quotes (').


Track conversions


First, go to the code editor and find the file named thank_you.html . It should look something like this:


This is the page that is displayed once a customer has successfully checked out, so at this point, we have access to their order information which we will need in this step.

You will need four things to setup the tracking pixel.

What you need: How to get it: 

  • AMOUNT = {{ order.total_price * 0.01 }} 
  • UNIQUE_ID = {{ }} 

This items are directly available on the thank you page trough the special curly bracket ‘{{}}’ markup. 

Now we’re ready to create the pixel. It’s done by adding an HTML image element to your thank you page to track the event.

Then you would add this piece of code right above the {% endblock %} on the thank you page: eg. :

<img src="{KEY}&id={{ }}&amount={{order.total_price * 0.01}}&payment=online" width="1" height="1">



Be carful! Remember to replace KEY with your KEY (retrieve it in your account, menu “config”, then “conversion code” green button)



Congratulations, you complete the installation of your affiliate program tracking codes.