If you run A/B tests on your Shopify store, you need to know which variant actually drives more sales—not just clicks or add-to-carts. Stellar lets you track completed purchases as conversions so you can see real revenue impact. This article walks you through the full setup in three steps: install the snippet, add the pixel, and create the goal.
Quick overview: You'll add the Stellar snippet to your store (for visitor attribution), a Custom Pixel in Shopify (to capture checkout completions), and a Shopify Purchase goal in Stellar. Total setup time is about 10 minutes.
You'll need:
yourstore.com)The Stellar snippet runs on your store pages and attaches a visitor ID to your cart. When a customer completes checkout, Shopify sends that ID with the order—so we can attribute the purchase to the right experiment variant. Without this step, purchases won't be attributed.
theme.liquid and paste the snippet inside the <head> section.See our Install Stellar Snippet guide for detailed instructions.
Shopify's Custom Pixels let you run code when checkout completes. We send that purchase event to Stellar so it can be counted as a conversion. Make sure Step 1 is done first—the pixel needs the visitor ID from the snippet.
YOUR_API_KEY with your Stellar API key (from your project's domain settings or the snippet installation screen):Where to find your API key: In Stellar, go to your project → Domain settings (or the page where you copy the snippet). Your API key is the long encrypted string in the snippet URL.
analytics.subscribe('checkout_completed', (event) => {
const checkout = event.data?.checkout;
if (!checkout) return;
const visitorId = checkout.attributes?.find(
(a) => a.key === 'stellar_visitor_id'
)?.value;
const orderId = checkout.order?.id;
fetch('https://api.gostellar.app/public/shopify/purchase', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
apiKey: 'YOUR_API_KEY',
visitor_id: visitorId,
order_id: orderId,
shopify: { checkout },
ts: Date.now(),
}),
keepalive: true,
});
});The stellar_visitor_id comes from the cart attributes that the Stellar snippet adds when visitors browse your store. This allows us to attribute the purchase to the correct experiment variant.
Important: Without the visitor ID, we cannot attribute the purchase to an experiment. Make sure the Stellar snippet is installed on your store before the pixel.
In Stellar, create a conversion goal of type "Shopify Purchase" and attach it to your experiment. This tells Stellar which experiment results to update when a purchase comes in.
Once set up, purchases will be attributed to the variant the visitor saw when they completed checkout. You can use the same Shopify Purchase goal across multiple experiments.
If your thank you page is on your store domain (not Shopify's checkout domain), you can use a Custom goal as a fallback. Add a script to your thank you page that calls:
window.__stellar.conversion(YOUR_GOAL_ID);
Create a Custom goal, note its ID, and call this when the thank you page loads. This works when the Stellar snippet loads on that page.
theme.liquid and loads on your store pages.We deduplicate by order ID. If the same order is sent multiple times (e.g. customer revisits the thank you page), we only count it once.
If you have a CSP, ensure api.gostellar.app (or your Stellar API domain) is allowed for fetch requests.
After completing these steps, purchases will flow into Stellar as conversions. You'll see them in your experiment results, including conversion rate and revenue (if you set a conversion value). Run a test order to confirm everything works.
Need help? Contact us at hello@gostellar.app.