Shopify integration

Setup your Shopify affiliate marketing program.


Shopify is the best-selling SaaS e-commerce platform in the world! It is used by several million merchants to sell their products.
This is an all-in-one software, reliable with many useful features, a marketplace, tailor-made themes and 5-star customer support.

If creating your online store with Shopify is simple, generating traffic to it may be random. That’s why our guide to onboarding your Shopify affiliate marketing program is here to help.


On our side, Affilae is an affiliate marketing software, helping marketers growth their online businesses with the right affiliate and influencer partnerships.



shpoify and affilae



Well done! You’ve created your new affiliate program. Now you’ve to set up tracking scripts to check if your affiliate sales are taken into account.

To install the tracking scripts for your Shopify affiliate program, follow these steps:
If you are using redirect tracking, go to step 2.


Track clicks from your partners


This script must be placed on all pages in the<body> tag.

In Shopify, go to the admin and click:

  • ” Online store “ menu
  • Then, on ” Action “ button
  • And on ” Edit HTML / CSS “

Then select the theme.liquid file in the tree and add the following code in the <body> tag.


➜ Caution! This script is an example, you must replace PROGRAM_ID by the program_id available in your program “configuration”, “tracking” then “integration with an Affilae plugin”.


<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);



Shopify affiliate marketing clic



Track sales


Go to Shopify admin and click in:

  • ” Settings “ menu
  • And ” Checkout “

Locate the “Additional content & scripts” field and copy and paste the following code:



{% assign product = '' %}
{% assign discount = '' %}
{% assign discounts_list = '' %}
{% assign products_list = '' %}

{% if order.discount_applications.size > 0 %}
   {% for discount_application in order.discount_applications %}
      {% assign discounts_list = discounts_list | append: ';' | append: discount_application.title %}
   {% endfor %}
   {% assign discount = discounts_list | remove_first: ';' %}
{% endif %}

{% if order.line_items.size > 0 %}
   {% for line_item in order.line_items %}
      {% assign products_list = products_list | append: ';' | append: line_item.product_id %}
   {% endfor %}
   {% assign product = products_list | remove_first: ';' %}
{% endif %}

< iframe src="{{ order_number }}&amount={{ subtotal_price | money_without_currency |  replace: '.', '' }}&payment=online&customer={{ }}&voucher={{ discount }}&product={{ product }}" width="1" height="1" >

<!-- AFFILAE END -->


  You only need to replace the value  YOUR.KEY  with the key of the conversion code found in your Affilae account: go to the “configuration” menu, “tracking” and then find your key in the integration with an Affilae pluginpart.

Shopify affiliate marketing conversion

To go further, see Shopify docs.

Now, you have to test a conversion before starting – follow our guideline: Test tracking.

Please, if you have a question, if you detect a bug, or just for a proposal, do not hesitate to contact our dedicated support team.