# Keeping our staging theme's test traffic out of production data

Asked by Jonas Petit on 2025-05-20. Tags: shopify, environments, workflow, debugging.

Hello, hoping someone can help with our release process. We test theme changes on
a staging domain before pushing them to the live store, and I noticed our own test
sessions showing up in the production metrics, which pollutes the numbers a bit.

While trying to fix this I created a second setup for staging, but now requests
from the staging domain fail with an origin error in the console.

How is dev and prod supposed to be separated properly, and what did I break with
the origin error? thanks in advance

## 1 answer

### Answer from Sam Okafor (2025-05-20)

You are on the right track with a second setup. Applications in Croct support
separate dev and prod environments, each with its own credentials, and that is
the intended way to keep staging sessions out of production data. The
`croct.json5` config file maps which application is used per environment, so
your staging build points at the dev application and the live theme at prod.

The origin error is the documented "unauthorized origin" problem: each
application only accepts requests from domains listed in its trusted origins.
Your staging domain is not on that list yet for the environment it is hitting.
Add the staging domain to the trusted origins of the dev application in the
dashboard and the requests will go through.

Once that is in place, everything you do on staging (sessions, events, slot
requests) lands in the dev environment and your production metrics stay clean.

#### Reply from Jonas Petit (2025-05-21)

That was it, the staging domain was missing from the dev application's
trusted origins. Both environments working cleanly now. Much appreciated!
