Shopify integration (Shopify Basics)

Modified on Fri, 5 Apr at 8:00 AM

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.

 

 

 

 

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”.

<!-- STARTING AFFILAE TRACKING CODE -->

<script type="text/javascript">    var _ae = {        "pid":"PROGRAM_ID",    };    (function() {        var element = document.createElement('script'); element.type = 'text/javascript'; element.async = true;        element.src = '//static.affilae.com/ae-v3.5.js';        var scr = document.getElementsByTagName('script')[0]; scr.parentNode.insertBefore(element, scr);    })();
</script>

<!-- ENDING AFFILAE TRACKING CODE -->

 

 

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:

 

{% if order == nil %}
<script>
location.reload();
</script>
{% endif %} 
<!-- AFFILAE BEGIN -->
 {% 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="https://lb.affilae.com/?key=YOUR.KEY&amount={{ order.subtotal_price | money_without_currency | replace: '.' | '' }}&currency={{currency}}&payment=online&customer={{ order.customer }}&voucher={{ discount }}&product={{ product }}&v=shopify&id={{ order.order_number }}" frameborder="0" width="1" height="1"></iframe>

<!-- 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.





3. Special cases :


a. Integration via Recharge

If you need to set tracking via Recharge, you’ll need to integrate a specific script.

In the section dedicated to Recharge, please insert the following script :

<img src="https://lb.affilae.com/?key=YOUR.KEY&id={{ order_number }}&amount={{ subtotal_price }}&payment=online&customer={{ customer.shopify_customer_id }}&voucher={{ discount_code }}" width="1" height="1">
Saisir du code
In this code, you only need to replace the YOUR.KEY variable with the conversion code key found in the “configuration” menu, then “tracking” and “integrations with an Affilae module” in your Affilae program.



b. Integration via GetJust

If you use the “GetJust” solution, you’ll need to integrate a specific script.

Please integrate the following script :

 

<!-- AFFILAE BEGIN -->
 {% 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="https://lb.affilae.com/?key=YOUR.KEY&id={{ order.order_number }}&amount={{ order.subtotal_price | money_without_currency }}&payment=online&customer={{ order.custumer }}&voucher={{ discount }}&product={{ product }}" frameborder="0" width="1" height="1"></iframe>

<!-- AFFILAE END -->
code Shopify JUST

In this code, you only need to replace the YOUR.KEY variable with the conversion code key found in the “configuration” menu, then “tracking” and “integrations with an Affilae module” in your Affilae program.


To go further, see Shopify docs.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article