Last updated: 2026-04-06
Reference
Environments¶
Environments allow you to deploy tag configurations to different contexts (development, staging, production) with isolated settings and revision control.
Understanding Environments¶
An Environment represents a deployment target for your tag management configuration:
- Revision Control: Each environment can run a different revision
- Custom Domains: Optional custom domain for tag delivery
- Environment Variables: Accessible in rules, conditions, and actions
- SSL Certificates: Automatic or custom certificate management
Environment Structure¶
Text Only
Application
├── Development Environment
│ ├── Domain: dev.example.com
│ ├── Revision: Draft (work in progress)
│ └── Variables: DEBUG_MODE=true
├── Staging Environment
│ ├── Domain: staging.example.com
│ ├── Revision: Release candidate
│ └── Variables: DEBUG_MODE=false
└── Production Environment
├── Domain: www.example.com
├── Revision: Stable release
└── Variables: DEBUG_MODE=false
Creating Environments¶
- Navigate to your application in Dxtra Tag Manager
- Go to Environments section
- Click "Add Environment"
- Configure settings:
- Name: Descriptive name (e.g., "Staging")
- Domain: Optional custom domain
- Revision: Select which revision to deploy
Environment Configuration¶
Basic Settings¶
| Setting | Description |
|---|---|
| Name | Environment identifier |
| Custom Domain | Your own domain for tag delivery (optional) |
| Revision | Which configuration version to deploy |
| SSL Certificate | Automatic (Let's Encrypt) or custom |
Environment Variables¶
Define variables accessible in rules and actions:
JavaScript
// Access environment variables in actions
const debugMode = '{{Environment.DEBUG_MODE}}';
const analyticsEndpoint = '{{Environment.ANALYTICS_ENDPOINT}}';
if (debugMode === 'true') {
console.log('Debug mode enabled');
}
Common environment variables:
| Variable | Development | Staging | Production |
|---|---|---|---|
DEBUG_MODE | true | false | false |
ANALYTICS_ENDPOINT | Dev endpoint | Staging endpoint | Production endpoint |
DATA_RETENTION_DAYS | 7 | 30 | 90 |
Deployment Workflow¶
Standard Workflow¶
- Development: Create and test new configurations
- Staging: Finalize revision and validate
- Production: Deploy tested configuration
Deploying a Revision¶
- Finalize your revision (lock changes)
- Navigate to the target environment
- Select the revision to deploy
- Verify deployment using debug mode
Rollback¶
To rollback to a previous configuration:
- Go to the environment you want to rollback
- Select a previous revision from the revision list
- Deploy the earlier revision
Custom Domains¶
Setting Up a Custom Domain¶
- Add your domain in environment settings
- Configure DNS with a CNAME record pointing to:
- SSL certificates are provisioned automatically via Let's Encrypt
DNS Configuration Example¶
After DNS propagation, your tags will be served from https://tm.yourdomain.com.
Environment-Specific Rules¶
Configure rules that behave differently per environment:
JavaScript
// Example: Debug logging only in development
if ('{{Environment.DEBUG_MODE}}' === 'true') {
console.log('Rule fired:', '{{Rule Name}}');
console.log('Event data:', '{{Event Data}}');
}
Conditional Tag Loading¶
JavaScript
// Load analytics only in production
const environment = '{{Environment.NAME}}';
if (environment === 'production') {
// Production analytics
gtag('config', 'GA_MEASUREMENT_ID');
} else {
// Development/staging analytics (or none)
console.log('Analytics disabled in', environment);
}
Best Practices¶
Development Environment¶
- Enable debug mode for comprehensive logging
- Use draft revisions for active development
- Short data retention for testing data
Staging Environment¶
- Mirror production settings as closely as possible
- Use finalized (locked) revisions
- Test all integrations before production deployment
Production Environment¶
- Only deploy thoroughly tested revisions
- Disable debug mode
- Configure appropriate data retention
- Use custom domain for branding
Troubleshooting¶
Environment Not Loading¶
- Check revision status: Ensure a revision is selected
- Verify domain configuration: DNS must be properly configured
- Check SSL certificate: Allow time for certificate provisioning
Variables Not Accessible¶
- Verify variable name: Use exact case-sensitive name
- Check syntax: Use
{{Environment.VARIABLE_NAME}} - Confirm variable is defined: Check environment settings
Support¶
- Documentation: Full environment management guide
- Support Email: support@dxtra.ai (include "Environments" in subject)
Continue to Revision Control to learn about version management and deployment history.