On this page
What this issue is
Most sites have at least two environments. Staging is a private copy where you test changes. Production is the live site your visitors and ad traffic reach. Each one has its own settings: API addresses, payment keys, analytics IDs, form endpoints and CRM connections.
Staging config in production happens when staging values end up on the live site. It usually follows a deploy, a database or settings copy, or a hardcoded value that nobody swapped before release. Typical examples are https://api.staging.example.com, a Stripe key starting with pk_test_, a GA4 ID from a test property, or a form action pointing at a sandbox.
Why it costs you leads or sales
The page still loads and looks normal, so nobody notices. But behind it, things fail quietly. A form may post to a staging endpoint, so leads never reach your CRM. A checkout using a test key cannot take real payments. Tracking sent to a test property means your ad platforms and reports see nothing, so campaigns optimise on missing data.
- Ad clickVisitor lands on the live page
- Form submitPage looks fine and shows a thank-you
- Staging APIForm posts to the staging URL
- CRM and inboxLead never arrives
- Ad conversionNot recorded or sent to a test property
The visitor sees a working form, but the data goes to the wrong place.
Example: a form posting to a staging endpoint drops CRM leads to zero while visitors still see a thank-you page.
How to check if your site has it
Check the live site, not staging. Open a key page in a private window and look at what it actually loads.
View the page source
Open the live page, right-click and choose View page source. Search (Ctrl+F or Cmd+F) for
staging,stage,dev.,test,sandboxandlocalhost.Watch the Network tab
Open browser DevTools, go to Network, reload and submit your form. Look at the request URLs. Any call to a staging or sandbox host is a problem.
Check payment keys
Search the source for
pk_test_. Live Stripe publishable keys start withpk_live_. Other providers also separate test and live keys, so check their docs.Check tracking IDs
In Network, filter for
collectorg/collectand confirm the GA4 measurement ID (G-XXXXXXX) matches your live property. Do the same for Meta pixel and Google Ads IDs.Check the deployed settings
Review environment variables or config files in your host or CMS for the production environment and compare them with the staging values.
| Setting | Staging looks like | Live should look like |
|---|---|---|
| API base URL | api.staging.example.com | api.example.com |
| Stripe publishable key | pk_test_... | pk_live_... |
| GA4 measurement ID | ID of a test property | ID of your live property |
| Form endpoint | Sandbox or test URL | Production form or CRM URL |
| Site URL / canonical | staging.example.com | www.example.com |
How to fix it
The fix is to replace each staging value with its live equivalent, then redeploy. Where you do that depends on your platform.
Check Settings and General
Under Settings > General, confirm WordPress Address and Site Address are your live domain.
Check plugin settings
Open your form, payment and SEO plugins and replace test API keys or sandbox modes with live ones. Many have a Test mode toggle.
Check wp-config.php
Look for hardcoded constants such as WP_HOME, WP_SITEURL or custom API keys and make sure they hold live values.
Check payments
Under Settings > Payments, make sure no provider is in test mode and Bogus Gateway is not active.
Check theme code and apps
Search the theme code for staging URLs or test IDs, and check app settings for sandbox keys.
Check connected channels
In Settings > Customer events and your Google and Meta channels, confirm the live pixel and property IDs.
Check the container
Confirm the live site loads the production container ID (GTM-XXXX), not a staging one.
Use variables
Use a Lookup Table variable that maps the hostname to the right GA4 ID, so staging and live IDs never get mixed up.
Publish the right version
Check Versions and make sure the live workspace version has the live IDs, then publish.
Check custom code
In Site settings > Custom code and in page-level custom code, replace staging IDs and URLs.
Check form and integration settings
Confirm form actions and connected apps use live endpoints and keys.
Publish to the live domain
Publish again so the live domain picks up the changes.
Check integrations
In Settings > Integrations, confirm payment providers are in live mode.
Check funnel tracking
In each funnel and website, check Settings > Tracking code and pixel IDs for test values.
Check webhooks
Review workflows that call webhooks and make sure URLs point to production endpoints.
Check payment settings
Under Settings > Accept Payments, confirm providers are connected in live mode.
Check marketing integrations
In Marketing Integrations, check the Google Analytics and pixel IDs.
Check custom code
In Settings > Custom code, remove staging URLs and test IDs.
Check Code Injection
Under Settings > Developer Tools > Code Injection, replace test IDs and URLs.
Check Commerce
Under Commerce > Payments, confirm Stripe or PayPal is not in test mode.
Check integrations
Review connected analytics and form storage settings.
Review environment files
Compare
.env.productionwith.env.staging. Production should hold only live values, set in your host's secret store.Remove hardcoded values
Search the code for staging hostnames and
pk_test_/sk_test_strings, and read them from environment variables instead.Redeploy and rebuild
Many front-end builds bake values in at build time, so rebuild with production variables, not just restart.
grep -rniE "staging|sandbox|localhost|pk_test_|sk_test_" ./src ./public ./config --exclude-dir=node_modulesHow to confirm it's fixed
- Page source has no staging, sandbox or localhost strings
- Network requests from the form go to production hosts
- Payment keys on the page start with the live prefix
- GA4, Ads and Meta hits carry your live IDs
- A test lead reaches the inbox and CRM
- Cached and CDN copies are purged so old values are gone
How to prevent it happening again
- Keep staging and production settings in separate environment variables, never in shared code
- Never copy a staging database or settings export over production without a clean-up step
- Add a pre-release check that fails the build if
staging,pk_test_orlocalhostappears in output - Use hostname-based tag rules so test IDs cannot fire on the live domain
- Re-test a form and a checkout right after every deploy
- Document who owns each key and where it lives
Staging config live
- Form posts to a staging endpoint
- Checkout uses pk_test_ key
- Tracking goes to a test property
Live config
- Form posts to production CRM
- Checkout uses pk_live_ key
- Tracking reaches the live property
How FunnelGuard handles this
FunnelGuard detects this issue only partly. It runs your real customer journey on a schedule and applies two checks that relate to it: a text_absent check and a tag_ids check.
With text_absent, you can name text that must not appear on a page, such as staging or a test hostname, and FunnelGuard flags the step if it shows up in the page. With tag_ids, it checks that the tracking hits sent to ad and analytics platforms carry the IDs you expect, so a test GA4 or pixel ID is caught. A failure is re-checked from a second region before one alert goes out with a screenshot and a likely cause.
What it does not check: your server-side settings, environment variables or secret stores, API URLs that never show in the page or tracking hits, or whether a payment key is a test or live one unless it appears as text you told it to look for. It never enters real card details, so it cannot prove a live payment works.
Questions people ask
Why is my live site using staging settings?
Usually a deploy, settings copy or database import carried staging values into production, or a value was hardcoded and never swapped. Compare your production and staging environment variables to find the difference.
How do I check if my website is using a Stripe test key?
View the page source or Network tab and search for pk_test_. A live publishable key starts with pk_live_. Also check the Stripe dashboard to see whether real payments are being received.
Why are my form leads not reaching my CRM after a deploy?
The form may be posting to a staging endpoint or using a test API key. Check the form request in the browser Network tab and confirm it goes to your production URL, then submit a test lead.
Why is GA4 showing no data after a release?
The live site may be sending hits to a test measurement ID, or the tag was swapped for a staging container. Check the G- ID in the collect request and compare it with your live property.
How do I stop staging config reaching production?
Keep separate environment variables per environment, add a build check that fails on staging strings or test keys, and never copy staging settings over production. Test a form and checkout after each deploy.
Can a monitoring tool detect staging config in production?
Partly. A tool like FunnelGuard can flag staging text on a page and check that tracking hits carry the expected IDs, but it cannot see server-side settings or secret stores, so review those by hand.
Do I need to rotate keys if a test key was live?
Test keys are low risk, but a secret key exposed in page source should be revoked and replaced. Always check the provider's dashboard for unexpected activity.
Related issues
- OPS-292Deploy broke landing page or formFix guide
- OPS-293Deploy removed tracking snippetFix guide
- OPS-296Staging site indexed / publicly accessibleFix guide
- OPS-297Production noindex left from stagingFix guide
- OPS-299Environment variable missing after redeployFix guide
- OPS-304Analytics consent config reset by deployFix guide