Before you start
- Set the program website in AgentRef to the same root domain as your storefront.
- Copy the exact script snippet from
Settings -> Integration. - Decide whether your sales flow uses native Shopify checkout or a supported Stripe flow outside it.
Install the script in your storefront theme
The most reliable Shopify install is still theme-level and global.- In Shopify admin, open
Online Store -> Themes. - On your active theme, click
... -> Edit code. - Open
layout/theme.liquid. - Paste the AgentRef script before the closing
</head>tag.
- Save and publish the theme change.
What Shopify supports today
| Flow | Status with AgentRef |
|---|---|
| Shopify storefront page with Stripe Payment Links, Buy Buttons, or Pricing Tables embedded directly on the page | Supported directly as long as the AgentRef script loads on that same page. |
| Custom app or backend that creates Stripe Checkout Sessions outside Shopify’s native checkout | Supported, but you must follow the Stripe guide. |
| Native Shopify cart, checkout, or Shop Pay flow | Not an automatic AgentRef attribution surface today. |
What that means in practice
- If Shopify is only your marketing layer and the actual paid checkout happens in your own Stripe flow, AgentRef can work well.
- If you rely on Shopify’s own checkout, use a deliberate server-side reporting strategy or a different supported checkout surface.
- Do not promise affiliates automatic Shopify-native attribution unless you have built and tested that bridge intentionally.
Multi-domain and consent notes
- If your storefront is
www.example.comand your app or billing area isapp.example.com, install AgentRef on both. - If Shopify uses a different root domain than the page that starts checkout, cookies will not carry across automatically.
- If you use a consent banner, call
window.AgentRef.setConsent('granted')after opt-in.
Verify the installation
Verify storefront tracking
Open a real affiliate link to the storefront and confirm
agentref_cid and agentref_pid appear.Confirm the published theme contains the script
View page source or DevTools Network on the live storefront.
Validate the actual checkout path
If you use native Shopify checkout, stop here and document that this is not an automatic AgentRef conversion path. If you use Stripe outside Shopify checkout, continue with the Stripe guide.
Troubleshooting
- The script is in the theme editor but not live: the edited theme may not be the active theme.
- Storefront clicks show up but conversions do not: this is expected for native Shopify checkout unless you built a separate attribution bridge.
- Cookies disappear between storefront and app: install AgentRef on both subdomains and keep everything under one root domain where possible.
Related docs
Stripe Checkout
Use this if your paid flow leaves native Shopify checkout and creates Stripe sessions directly.
Server-Side Tracking
Fallback when the platform-controlled checkout path cannot pass AgentRef through automatically.
How Tracking Works
Understand what the script does and what it does not do.