πŸ“ΉπŸ”΄ LIVE NOW

Ad

Ad

ShopifyAffiliateSetup

πŸ”— Shopify Affiliate Integration Setup

Connect wolfbeans.com orders to CareZiaSpace affiliate tracking

πŸ”„ How the Full Flow Works

1️⃣

Affiliate shares link

careziaspace.com/?ref=WOLF42XK

2️⃣

Visitor lands on CareZiaSpace

ref code saved to browser storage

3️⃣

Visitor clicks "Shop Coffee"

wolfbeans.com/?ref=WOLF42XK

4️⃣

Shopify JS captures ref

Saved as cart attribute "affiliate_ref"

5️⃣

Order is placed

Shopify fires webhook to Base44

6️⃣

Commission recorded

40% added to affiliate earnings + WolfCoin log

How to add this to Shopify:

1. Go to wolfbeans.com Shopify Admin β†’ Online Store β†’ Themes

2. Click "Edit code" on your active theme

3. Open Layout β†’ theme.liquid

4. Paste the snippet just before the closing </body> tag

5. Click Save

<!-- CareZiaSpace Affiliate Tracking β€” Paste in theme.liquid before </body> -->
<script>
(function() {
  // Capture ?ref= from URL and store in cookie + localStorage
  var urlParams = new URLSearchParams(window.location.search);
  var ref = urlParams.get('ref');
  
  if (ref) {
    // Store for 30 days
    var expires = new Date();
    expires.setDate(expires.getDate() + 30);
    document.cookie = 'affiliate_ref=' + ref + '; expires=' + expires.toUTCString() + '; path=/';
    localStorage.setItem('affiliate_ref', ref);
  }

  // On cart page / checkout β€” inject ref into cart attributes
  function getAffiliateRef() {
    var cookie = document.cookie.split(';').find(function(c) { return c.trim().startsWith('affiliate_ref='); });
    if (cookie) return cookie.split('=')[1];
    return localStorage.getItem('affiliate_ref');
  }

  // Add ref to cart note attributes via AJAX
  var storedRef = getAffiliateRef();
  if (storedRef) {
    fetch('/cart/update.js', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        attributes: { affiliate_ref: storedRef }
      })
    }).catch(function() {});
  }
})();
</script>

Follow CareZiaSpace