Skip to content

Checkout URL

Configure checkout URL generation to avoid common tracking and attribution issues.

Overview

Follow this guide to learn how to correctly generate checkout URLs for a headless Shopify storefront so tracking, attribution, and marketing performance data remain accurate.

When building a headless Shopify storefront, the way you generate checkout URLs significantly impacts tracking accuracy and attribution. Many headless implementations mistakenly generate checkout URLs using the myshopify.com domain, which causes several critical issues that affect data quality and marketing performance.

Why Domain Matters

Using myshopify.com domains for checkout URLs creates three major problems:

Inflated Direct Traffic:

When users navigate from your custom domain www.example.com to a myshopify.com checkout, this breaks the user journey and causes traffic to appear as "direct" in analytics, even if the user originally came from a paid ad or other source.

Domain Verification Issues:

With iOS14.5 Facebook and other ad platforms require domain verification to process events properly. You cannot verify a myshopify.com domain, which means events sent from checkout pages on that domain may not be attributed correctly to your campaigns.

Cookie and Tracking Loss:

Most cookies can only be set and shared on the same top-level domain. When users navigate from example.com to myshopify.com, they lose all cookie data that affiliate trackers and other third-party tools rely on. This typically leads to poor attribution.

Correct Checkout URL Format

To avoid these issues, generate checkout URLs using your custom domain instead of myshopify.com. This ensures users stay on your verified custom domain throughout the entire journey, maintaining tracking accuracy and attribution.

When creating checkout URLs via the Shopify Storefront API, post your request to your custom domain endpoint shop.[websitedomain].com/api/graphql. This may also be a good time to start using API version to ensure the API does not change unexpectedly by using shop.[websitedomain].com/api/2021-07/graphql.

Common Questions

Does this require any special Shopify configuration?

No, as long as your custom domain is properly configured in Shopify's domain settings, the Storefront API will accept requests to your custom domain and return checkout URLs using that domain.

What if I'm already using myshopify.com checkout URLs?

Update your checkout URL generation logic to use your custom domain. Existing checkouts will continue to work, but new ones will use the correct domain and avoid the tracking issues.

Will this break my existing checkout flow?

No, this only changes the domain used in the checkout URL. The checkout functionality remains the same.