Skip to main content
DATALYR Container is a tag management system similar to Google Tag Manager that lets you add and manage tracking pixels, custom scripts, and third-party tags without editing your website code.

How It Works

The Container system loads a lightweight script (container.js) on your website that fetches and executes your configured tags based on triggers and conditions. Traditional Tracking:
<!-- Manual script management - requires code changes -->
<script src="https://track.datalyr.com/dl.js" data-workspace-id="ws_123"></script>
<script src="https://facebook-pixel.js"></script>
<script src="https://google-analytics.js"></script>
<script src="https://tiktok-pixel.js"></script>
With Container:
<!-- Single container script - manage everything from dashboard -->
<script defer src="https://track.datalyr.com/container.js" data-workspace-id="ws_123"></script>
All other scripts are managed from your DATALYR dashboard without touching code.

What You Can Manage

Tracking Pixels Add Meta Pixel, TikTok Pixel, Google Tag, and other tracking pixels with automatic configuration. Custom JavaScript Run custom JavaScript code on specific pages or events without editing your site. Third-Party Scripts Load external scripts (analytics, chat widgets, heatmaps) with trigger control. Event Tracking Track custom events, button clicks, form submissions, and more with conditional logic.

Key Features

GTM-Like Triggers

Fire tags based on events:
  • Page Load: Execute on initial page load
  • DOM Ready: Wait for DOM to be ready
  • History Change: Fire on SPA navigation (React, Vue, Next.js)
  • Scroll: Trigger when user scrolls past threshold
  • Visibility Change: Fire when tab becomes visible

Conditional Loading

Control when tags fire with conditions:
  • URL Path: Match specific pages or patterns
  • Query Parameters: Check for UTM parameters or custom params
  • Referrer: Target traffic from specific sources
  • Device Type: Mobile, tablet, or desktop only
  • Custom JavaScript: Write custom logic

Firing Frequency

Control how often tags execute:
  • Always: Fire every time trigger occurs
  • Once per Page: Fire only once per page load
  • Once per Session: Fire once per browser session

Built-In Variables

Use dynamic variables in your scripts:
  • {{Page URL}}: Current page URL
  • {{Page Path}}: URL path only
  • {{Page Title}}: Document title
  • {{Referrer}}: Document referrer
  • {{UTM Source}}: utm_source parameter
  • {{UTM Medium}}: utm_medium parameter
  • {{UTM Campaign}}: utm_campaign parameter
  • {{Query String}}: Full query string
  • {{User Agent}}: Browser user agent
  • {{Timestamp}}: Current timestamp

Use Cases

Manage Ad Pixels Add Meta Pixel, TikTok Pixel, and Google Tag from your dashboard. Update pixel IDs without deploying code. A/B Testing Load different scripts for different user segments using conditions. Gradual Rollouts Test new tracking on specific pages before rolling out site-wide. Event Tracking Track button clicks, form submissions, and custom interactions without code changes. Third-Party Integrations Add chat widgets, analytics tools, and heatmaps with conditional loading. SPA Support Automatically handle navigation changes in React, Vue, and Next.js apps.

Performance

The Container system is optimized for performance: Lightweight Container script is less than 40KB minified and deferred by default. Caching Scripts are cached for 30 minutes on the client and server. Async Loading External scripts load asynchronously without blocking page render. Conditional Execution Tags only load when conditions are met, reducing unnecessary requests. SPA Optimized Detects navigation changes without polling or heavy listeners.

Security

URL Validation All external scripts and pixels are validated for safe URLs (https:// only in production). CSP Support Supports Content Security Policy with nonce attributes. Sandbox Execution Custom JavaScript runs in sandboxed environments when possible. No eval() Inline scripts execute via Function constructor or CSP-nonce injection (no eval).

Limitations

No Server-Side Rendering Container scripts run client-side only. Use direct script installation for SSR. Browser Only Not available for mobile apps (use native SDKs instead). Delayed Loading Tags load after the container script fetches configurations (typically 50-200ms). 100 Script Limit Maximum 100 active container scripts per workspace.

Container vs Direct Installation

FeatureContainerDirect Installation
Code ChangesNone after initial setupRequired for each pixel
Update SpeedInstant from dashboardRequires deployment
SPA SupportAutomaticManual implementation
Conditional LoadingBuilt-inCustom code required
PerformanceSmall overhead (~50-200ms)Faster initial load
Mobile AppsNot supportedUse native SDKs

Next Steps

Need Help?

Questions about Container? Check our troubleshooting guide or contact support.