K

Shopify Integration Guide

Complete guide to setting up affiliate tracking on your Shopify store. Learn how to connect your store, set up webhooks, and add the tracking script.

Emil Klitmose

Written by Emil Klitmose

Updated recently

Revshare integrates seamlessly with Shopify to track affiliate sales. When a customer visits your store through an affiliate link and makes a purchase, the affiliate automatically earns their commission.

The integration uses Shopify webhooks to receive order notifications in real-time, ensuring accurate and instant tracking.

  • Real-time order tracking via webhooks
  • Automatic commission calculation based on order value
  • Works with custom domains and Shopify subdomains
  • Supports all Shopify plans

Overview

The Shopify integration consists of three main components:

  1. Store Connection — Authorize Revshare to access your Shopify store
  2. Webhook Setup — Create a webhook in Shopify to notify us of new orders
  3. Tracking Script — Add a script to your theme to capture affiliate referrals

Prerequisites

Before starting, make sure you have:

  • A Shopify store with admin access
  • A Revshare account with a program created
  • Access to edit your Shopify theme code

Step 1: Connect Your Shopify Store

Start by connecting your Shopify store to Revshare:

  1. Go to your program's Setup page in the Revshare dashboard
  2. Select Shopify as your integration
  3. Enter your Shopify shop domain (e.g., mystore for mystore.myshopify.com)
  4. Click Connect Shopify to authorize the connection

Not sure what your Shopify shop domain is? See our guide on What is a Shopify Domain?

You'll be redirected to Shopify to approve the connection, then back to Revshare.

Step 2: Create the Webhook

Create a webhook in Shopify to notify Revshare when orders are paid:

  1. In Shopify Admin, go to Settings → Notifications
  2. Scroll to the bottom and click Create webhook
  3. Set Event to: Order payment
  4. Set Format to: JSON
  5. Set URL to: https://www.revshare.so/api/shopify/webhook
  6. Click Save

Important: After creating the webhook, copy the Signing secret shown at the top of the webhooks section. You'll need to paste this in Revshare to verify webhook authenticity.

For detailed webhook instructions, see our Shopify Webhook Setup Guide.

Step 3: Add the Tracking Script

For detailed step-by-step instructions on adding the tracking script, see our Shopify Tracking Script Setup Guide.

Add the Revshare tracking script to your Shopify theme to capture affiliate clicks:

  1. In Shopify Admin, go to Online Store → Themes
  2. Click ...Edit code on your active theme
  3. Open theme.liquid in the Layout folder
  4. Paste the tracking script just before the closing </head> tag
  5. Click Save
<script
  async
  src="https://www.revshare.so/shopify-tracking.js"
  data-program-id="YOUR_PROGRAM_ID"
  data-domain=".yourdomain.com"
  data-cookie-duration="30"
></script>

Replace the values with your actual program settings:

  • data-program-id — Your Revshare program ID
  • data-domain — Your cookie domain (e.g., .mystore.com)
  • data-cookie-duration — Days the affiliate cookie should last

Tip: If your store uses a password page, also add the script to password.liquid to track visitors even before your store launches publicly.

Testing Your Setup

To verify everything is working:

  1. Create a test affiliate in your Revshare dashboard
  2. Visit your store using the affiliate's tracking link (e.g., yourstore.com?ref=test)
  3. Check that the ref cookie is set in your browser
  4. Place a test order (you can cancel it after)
  5. Check Revshare to see if the sale was tracked

Troubleshooting

Orders not appearing in Revshare

  • Verify the webhook URL is correct: https://www.revshare.so/api/shopify/webhook
  • Check that the webhook event is set to Order payment
  • Ensure you've saved the webhook signing secret in Revshare

Affiliate not getting credited

  • Confirm the tracking script is installed correctly
  • Check the browser for the ref cookie
  • Verify the cookie domain matches your store domain

Webhook verification failing

  • Double-check the signing secret is correctly copied
  • Make sure there are no extra spaces in the secret

Need more help? Check out our webhook setup guide or contact support.