Staging
Try guidance on your staging app before it reaches production, with a second publishable key.
When environments are on for your workspace, every item can be published to production, to staging, or to both, independently. Each environment has its own publishable key:
| Key | Shows |
|---|---|
pk_… | Content published to production |
pk_test_… | Content published to staging |
Both are in Settings → Install → Environments and publishable keys.
Set it up
- Put the
pk_test_…key in the snippet on your staging app. Use the same snippet as production with the other key. - Publish an item to staging. Your staging app shows it; production doesn't.
- When it looks right, publish the same draft to production.
Publishing to staging needs edit access. Publishing to production needs publish access and follows your workspace's approval rules.
Rotating a key
Rotate a key if it was copied somewhere it shouldn't be. Sites still using the old key stop showing guidance until you update their snippet.
Publishable keys can only read published content and send analytics, so they're safe in page source. To stop other sites from using them, set allowed domains.