Article

C2S – Shopify

The Affilae Shopify integration takes two installations: a tracking tag in your theme, which records clicks, and a custom pixel, which reports sales. You need both.

Before you start

  • Your program’s URL format is set to Parameter.
  • You have admin access to your Shopify store.
  • You have your Program ID and your Key. To find them, in Affilae, open Manage my programs, click your program, then Configuration. In the Tracking tab, scroll down to the Integration via an Affilae plugin section.
Affilae
MANAGE MY PROGRAMS
Configuration
My affiliates
Medias
Clicks
Conversions
Payments
The “Configuration” entry in the program menu.
Tip: the Key only appears once you have picked your commission rule in the dropdown. Before that you see {{KEY}}, which is not a value to copy.

Step 1, install the tracking tag in your theme

This tag records the click of a visitor sent by a publisher. Without it, the sale is reported with no click, so with no publisher to pay: this is the most common failure. Replace PID with your Program ID.

<script type="text/javascript">
  var _ae = {
    "pid":"PID",
  };
  (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>
  1. In your Shopify admin, open Online Store, then Themes.
  2. Click Actions, then Edit code.
  3. Open the theme.liquid file and paste the code inside the <body> tag.

Step 2, download the plugin and pick your file

Download version 1.7.4: shopify_affilae_v1.7.4.zip
MD5 checksum, to verify the file: 0537c19dddabe87013f86789b1ad9435

The archive contains two pixels. You install only one:

FILE WHEN TO CHOOSE IT
shopifyPixelConversion.js One conversion key for every buyer. This is the usual case.
shopifyPixelConversionOldNew.js One key for new customers and another for returning ones, if your program pays them differently.
Warning: never install both files on the same store. Every sale would be counted twice.

Step 3, create the pixel in Shopify

  1. In your Shopify admin, open Settings, then Customer events.
  2. Click Add custom pixel and name it, for example Affilae.
  3. Delete the default text and paste the entire content of the file you picked in step 2.

Step 4, fill in three values

At the top of the file, edit these lines only. Leave every other line as it is.

const PROGRAM_ID = 'YOUR_PROGRAM_ID';
const KEY = 'YOUR_KEY';
const PRICES_TAX_INCLUDED = true;
  • PROGRAM_ID: your Program ID.
  • KEY: your Key. With shopifyPixelConversionOldNew.js, fill in KEY_CUSTOMER_NEW (new customers) and KEY_CUSTOMER_OLD (returning customers) instead.
  • PRICES_TAX_INCLUDED: in Shopify, open Settings, then Taxes and duties, and look at the Include sales tax in product price and shipping rate checkbox. Checked: true (the usual case in France and Europe). Unchecked: false.
Note: what matters is how prices are displayed, not whether you charge VAT. Also check the Markets section: a market can override the store-level setting. A wrong value shifts every amount reported.

Step 5, set the pixel’s privacy settings

  1. Under Customer privacy, set Permission to Not required.
  2. Leave Data sale on the option stating that the data collected does not qualify as a data sale.

The Affilae pixel checks the buyer’s consent itself. When the buyer has refused it, the pixel reads nothing on their device: only an order placed with a promo code is reported, attributed to that code alone and with no customer id. If you would rather Shopify loaded the pixel only with the buyer’s consent, set the permission to Required: no order placed without consent will then be reported, promo code or not.

Step 6, save, connect and test

  1. Save the pixel.
  2. Click Connect pixel.
  3. Place a test order and check that it appears in Affilae.
Tip: a pixel that is saved but not connected reports nothing. This is by far the first cause of a silent integration.

Updating a store that is already set up

  1. Open your Affilae pixel and replace its whole content with the new file.
  2. Fill in the three values from step 4 again, with the same Program ID and the same key or keys. The new file resets every other line to its original value: if Affilae support had you change another line, tell them before updating.
  3. Check the pixel’s privacy settings (step 5), then save and place a test order.
New in 1.7.4: up to version 1.7.3, no order was reported when the buyer refused consent. From 1.7.4, if the pixel permission is set to Not required, an order placed with a promo code is reported despite that refusal, only to attribute the code (see step 5).

Related articles

Frequently asked
questions

Version 1.7.4, offered in step 2. If your store runs an earlier version, follow the “Updating a store that is already set up” section.

In order: is the pixel connected, not just saved? Is the tracking tag in the theme? Are the Program ID and Key the real values (not {{KEY}})? Is the pixel permission set to Not required?

Yes: Affilae receives the amount excluding tax and shipping, while the Shopify total includes them. If the gap looks abnormal, check the PRICES_TAX_INCLUDED value (step 4).

Two reasons. Orders from buyers who refuse consent are not reported, except those placed with a promo code, which are attributed to that code alone. And orders that do not go through the online checkout (subscriptions, in-store sales, draft orders, orders created by an app or a logistics provider) are out of reach of any pixel.

The pixel reports Shopify’s internal id, not the #1082-style number, which is not available to it. To reconcile the two, export your conversions from Affilae: the Shopify id appears in the Conversion ID column.

Check that you installed shopifyPixelConversionOldNew.js and filled in both keys, KEY_CUSTOMER_NEW and KEY_CUSTOMER_OLD. When Shopify does not let the pixel know whether this is a first purchase, the order is counted as a new customer.

Need help?

Stay up to date with the latest trends in affiliate marketing and never miss any of our articles.

Contact Us