Skip to main content

Setting Up Affiliate Tracking with Shopify

M
Written by Michel Almorin Martins

You can assign affiliate links to your creators and track how those links are used with affiliate tracking. With affiliate tracking, you can see how many page views, sales, and commissions your creator’s unique link has generated. This lets you not only easily pay out your creators, but also track where your most successful conversions are.

Different Ecommerce stores and websites have different steps for affiliate tracking. If you’re not integrated with Shopify or want to set up affiliate tracking on a website instead, check out our other articles on setting up affiliate tracking with WooCommerce or any website.

Additionally, consider adjusting your affiliate tracking setup if your Shopify storefront is transitioning to or fully migrated to Checkout Extensibility. The setup steps may differ depending on this status, and guidance for these variations is addressed in the following sections.


What You'll Need

  • Admin access to your Shopify account.


How to Do It

1. Navigate to Account > Settings. This will open your Settings page.

2. Select the Integrations setting. This will open a page with your current integrations.

3. Select Settings on the Affiliate Integration.

4. If you haven’t generated a token yet, select Generate Token in Step 1: Generate a Token (if you’ve generated one before, you should see the token here instead).

5. This will generate:

  • Your token and the date it was generated.

  • A copy button.

  • A delete button.

  1. Install the Affiliate SDK script to ensure compatibility across all Shopify setups. Paste the following script within your website's header or just before the closing </body> tag on every page:

    (function () {    Grin = window.Grin || (window.Grin = []);    var s = document.createElement('script');    s.type = 'text/javascript';    s.async = true;    s.src = 'https://d38xvr37kwwhcm.cloudfront.net/js/grin-sdk.js';    var x = document.getElementsByTagName('script')[0];    x.parentNode.insertBefore(s, x);})();

7. Select Step 3: Enable Conversion Tracking.

8. Select the Copy the Shopify Code button under the Shopify section to copy the script onto your clipboard.

Depending on your store's migration status to Checkout Extensibility, you may need to use GRIN pixel scripts instead of this liquid script for conversion tracking. Refer to the section outlining options for Shopify's Checkout Extensibility for more details.

  • Alternatively, you can copy the code from below:

<script> Grin = window.Grin || (window.Grin = []); var order_number = '{{ order_number }}', order_name = '{{ name }}', amount = '{{ subtotal_price | money_without_currency }}', currency = '{{ currency }}'; Grin.push(['conversion', amount, { order_number: order_number, name: order_name, currency: currency }]); </script>

9. Log in to Shopify.

10. Navigate to Settings > Checkout and navigate to the Order status page section.

11. Paste the copied Shopify code from Step 8 into the Additional Scripts box. If there are existing scripts in the box already, paste the code in a new line after the existing scripts.

Your Shopify account is now set up for affiliate tracking in GRIN!

Testing and Verifying Your Setup

Once your Shopify account is configured for affiliate tracking in GRIN, ensure everything is functioning by:

  1. Running a link test to confirm conversions are recorded.

  2. Checking the Conversion Analytics dashboard in your GRIN account.

  3. Testing with dynamic order variables to ensure accuracy in tracking.


How a Conversion Is Attributed When a Creator Uses Both a Link and a Code

A shopper will sometimes arrive through a creator’s affiliate link and also apply that creator’s discount code on the same purchase. When that happens, the conversion is counted a single time, so the order is not credited twice in your reporting or in your commissions.

By default, that single conversion is attributed to the discount code. The reason is that the Affiliate Link Attribution setting is disabled when your store is connected, which leaves the code as the credited source whenever both a link and a code are present on the same order.

If you would rather have the affiliate link take precedence over the discount code, enable Affiliate Link Attribution in the Connection Settings for your store. With that setting enabled, an order that carries both a creator’s link and that creator’s code is credited to the link.

(internal, remove before publishing) Confirm the exact label of the Affiliate Link Attribution setting and where it sits within the store Connection Settings before publishing this section.


Shopify Privacy Policy

If your Brand's Shopify store has the below setting enabled for Customer privacy, any shopper visiting your store will have a banner displayed to accept cookies.

If they are visiting from an affiliate link generated from GRIN, these cookies are required to track conversions. If a shopper rejects or ignores this banner, no sales will be tracked in GRIN.

You can visit your brand's Shopify store Privacy Policy by visiting Shopify's Privacy Page.

Did this answer your question?