Shopify

How to Add Affiliate Program to Shopify with Blossu

Add referral tracking to your Shopify store by editing your theme code. This takes just a few minutes.

Image: Shopify + Blossu integration overview
1

Go to theme settings

In your Shopify admin, navigate to Online Store → Themes.

Find your current theme and click the "..." button, then select "Edit code".

Image: Accessing theme editor in Shopify admin
2

Edit theme.liquid

In the Layout folder on the left sidebar, click on theme.liquid.

Find the </head> tag (you can use Ctrl+F or Cmd+F to search) and paste this script just before it:

HTML
<script
  async
  src="https://js.blossu.com/v1/blossu.js"
  data-program-id="YOUR_PROGRAM_ID"
></script>

Replace YOUR_PROGRAM_ID with your actual program ID from the Blossu dashboard.

Image: Adding the script in theme.liquid
3

Save and test

Click Save in the top right corner of the code editor.

To verify the installation:

  • Visit your store with a test referral link (e.g., yourstore.myshopify.com?via=test)

  • Open your browser's developer console

  • Check if window.blossu_ref_id is defined

Image: Verifying the installation in browser console

How it works with Shopify

When a customer arrives at your store via a partner referral link, the script captures the referral and stores it as a cookie. When they complete a purchase, Blossu automatically attributes the sale to the referring partner.

The referral cookie persists for 60 days, so even if the customer leaves and comes back later, the referral will still be tracked.

Next steps

Now that you have tracking set up, you need to connect your payment platform to automatically track conversions and calculate partner commissions.