🔍 Overview
If your Shopify store uses Cloudflare as a proxy (for example, a custom domain pointed through Cloudflare), you cannot install Search Atlas using the standard Shopify app method alone. Instead, you need to deploy a Cloudflare Worker that intercepts requests and injects the Search Atlas script before pages are served to visitors. This guide walks you through the full setup.
⚙️ How It Works
When a visitor lands on your Shopify store, the request passes through Cloudflare before reaching Shopify's servers. A Cloudflare Worker sits in that path and can modify the HTML response — in this case, injecting the Search Atlas tracking and optimization script into every page automatically. This ensures Search Atlas receives accurate data and can serve optimized content without modifying your Shopify theme manually.
✅ Before You Begin
Make sure you have the following ready before starting:
- Access to your Cloudflare account with the zone for your Shopify domain
- Your Search Atlas project created and your site added inside the Search Atlas platform
- Your Search Atlas script snippet — available inside your project settings
- A Cloudflare plan that supports Workers (the Free plan includes Workers)
🚀 Step 1 — Create a Cloudflare Worker
- Log in to your Cloudflare dashboard.
- Navigate to the Workers section of your account.
- Create a new Worker and give it a recognizable name (for example, search-atlas-injector).
- Save or deploy the Worker with a placeholder script — you will replace the script content in the next step.
✏️ Step 2 — Add the Worker Script
Once your Worker is created, open its editor and replace the default script with logic that does the following:
- Intercepts every incoming request to your Shopify domain.
- Fetches the original HTML response from Shopify.
- Injects your Search Atlas
<script>tag (copied from your Search Atlas project settings) just before the closing</head>tag in the HTML. - Returns the modified HTML to the visitor with the original response headers preserved.
Because the exact script depends on your specific Search Atlas project snippet and your Cloudflare Worker runtime version, our support team can provide you with a ready-to-paste Worker script tailored to your setup. To get it, please have the following ready when you reach out:
- Your Shopify store domain (the custom domain routed through Cloudflare)
- Your Search Atlas project name
- Your Search Atlas script snippet (found in your project settings)
- Your Cloudflare Workers plan (Free, Pro, etc.)
If you need further assistance, open the chat widget in the bottom-right corner of the platform and type human teammate to be connected with a member of our team.