Skip to content
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

  1. Navigate to your application in Dxtra Tag Manager
  2. Go to Environments section
  3. Click "Add Environment"
  4. Configure settings:
  5. Name: Descriptive name (e.g., "Staging")
  6. Domain: Optional custom domain
  7. 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

  1. Development: Create and test new configurations
  2. Staging: Finalize revision and validate
  3. Production: Deploy tested configuration

Deploying a Revision

  1. Finalize your revision (lock changes)
  2. Navigate to the target environment
  3. Select the revision to deploy
  4. Verify deployment using debug mode

Rollback

To rollback to a previous configuration:

  1. Go to the environment you want to rollback
  2. Select a previous revision from the revision list
  3. Deploy the earlier revision

Custom Domains

Setting Up a Custom Domain

  1. Add your domain in environment settings
  2. Configure DNS with a CNAME record pointing to:
    Text Only
    tagmanager-edge.dxtra.ai
    
  3. SSL certificates are provisioned automatically via Let's Encrypt

DNS Configuration Example

Text Only
Type: CNAME
Name: tm (or your subdomain)
Value: tagmanager-edge.dxtra.ai
TTL: 300

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

  1. Check revision status: Ensure a revision is selected
  2. Verify domain configuration: DNS must be properly configured
  3. Check SSL certificate: Allow time for certificate provisioning

Variables Not Accessible

  1. Verify variable name: Use exact case-sensitive name
  2. Check syntax: Use {{Environment.VARIABLE_NAME}}
  3. 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.