Step One: Add a Click Tracking Google Tag
-
Title the tag "Shop My Shelf Click Tracking"
-
Set the Tag Type to Custom HTML
-
Set the HTML to:
-
<script defer src="https://static.myshlf.us/Affiliates/sms_aff_clicktrack.js"></script>
-
-
Set the Triggering field to Fire on a "Page View" on "All Pages"
-
Ensure the tag looks like the image below and press "Save"
-
Step Two: Integrate Order Tracking
Complete the following steps to set up a Shopify Custom App Pixel for order tracking:
-
Navigate to store settings in Shopify admin
-
Click "Customer Events" in the settings menu on the left
-
Click the "Add Custom Pixel" button in the top right, name the new pixel "ShopMy Checkout Tracking"
-
In the "Customer Privacy" section, make the following selections:
- Permission: Not required
- Data Sale: Data collected does not qualify as data sale
- ShopMy does not store or sell your customer information
-
Paste the following into the "Code" section to set up the ShopMy Order Tracking Integration:
-
analytics.subscribe('checkout_completed', event => { const checkout = event.data.checkout; const allDiscountCodes = checkout.discountApplications .map(discount => { if (discount.type === 'DISCOUNT_CODE') return discount.title; }) .filter(Boolean); const cookies = document.cookie .split(';') .reduce((res, cookie) => ({ ...res, [(cookie.split('=')[0] || '').trim()]: (cookie.split('=')[1] || '').trim() }), {}); const { sms_click_id } = cookies; const code = allDiscountCodes?.[0]; const shopmy_data = { orderAmount: checkout.subtotalPrice?.amount, orderId: checkout?.order?.id, clickId: sms_click_id, currency: checkout.currencyCode, is_returning_customer: false, page_url: window.location.href, code }; fetch(`https://api.shopmy.us/api/order_confirmation`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(shopmy_data) }) .then(r => { if (!r.ok) throw new Error('Invalid order request sent'); r.json(); }) .then(() => { const now = new Date(); document.cookie = `sms_click_id=;expires=${now.toUTCString()};path=/;`; document.cookie = `sms_click_time=;expires=${now.toUTCString()};path=/;`; }) .catch(() => { // ignore the error }); });
-
-
Click the "Save" button in the top search bar to save the new Custom Pixel.
-
Click the "Connect" button on the bottom right to activate the Custom Pixel.
- if you see the following message on the "Connect" button and you are unable to click it, make sure you have completed step 6 and saved changes thus far:
-
The pixel cannot be connected until a custom pixel script is saved for it
-
- if you see the following message on the "Connect" button and you are unable to click it, make sure you have completed step 6 and saved changes thus far:
Step Three: Request Testing
Contact your Brand Success Manager to place a test order and test the integration end-to-end. We will communicate with you any test order IDs we place so they can be cancelled after the integration is verified.
By adding our integration code to your site, you are agreeing to the terms of the ShopMy affiliate network. Please review these terms here.