Quick Comparison
| Feature | Container | Direct Installation |
|---|---|---|
| Code Changes | Once (initial setup) | Every pixel/script |
| Update Speed | Instant from dashboard | Requires deployment |
| Script Management | Visual dashboard | Edit code files |
| Conditional Loading | Built-in | Manual coding |
| SPA Support | Automatic | Manual setup |
| Performance | Small overhead (50-200ms) | Faster initial load |
| Complexity | Beginner-friendly | Developer required |
| Mobile Apps | Not supported | Use native SDKs |
| Third-Party Scripts | Unlimited | Manual addition |
| Testing | Easy A/B testing | Harder to test |
When to Use Container
You Should Use Container If:
You manage multiple tracking pixels Add Meta Pixel, TikTok Pixel, Google Tag, and more from your dashboard without editing code. You need to update pixels frequently Change pixel IDs, add new events, or update tracking without waiting for deployments. You have non-technical team members Marketers can add and manage tags without developer help. You run A/B tests on tracking Test different pixels on different pages using conditions. You have a Single Page Application Automatic SPA navigation detection (React, Vue, Next.js). You want conditional loading Only load scripts on specific pages, devices, or traffic sources. You need quick rollbacks Disable tags instantly from dashboard if something breaks.Container is Perfect For:
- E-commerce sites with multiple ad platforms
- Marketing teams managing their own tracking
- Agencies managing client pixels
- Sites testing new tracking tools
- Gradual pixel rollouts
When to Use Direct Installation
You Should Use Direct Installation If:
You need maximum performance Direct installation loads 50-200ms faster (no container fetch required). You have server-side rendering Container only works client-side. SSR needs direct installation. You rarely change tracking If your tracking is stable, direct installation is simpler. You have one or two scripts Container adds overhead for minimal benefit with few scripts. You need mobile app tracking Use native iOS or React Native SDKs, not Container. You want TypeScript support Use@datalyr/web SDK for full TypeScript integration.
Direct Installation is Perfect For:
- Simple sites with stable tracking
- Next.js apps using SSR
- Performance-critical sites
- Mobile applications
- Developer-focused teams
Performance Comparison
Container Performance
Initial Load:Direct Installation Performance
Initial Load:- Container adds ~60-180ms on first page load
- Subsequent pages are fast (scripts cached)
- Direct is faster but requires code changes for updates
- Both use defer/async loading (don’t block render)
Feature Comparison
Tracking Features
| Feature | Container | Direct |
|---|---|---|
| Attribution Tracking | ✅ Via dl.js integration | ✅ Built-in |
| Event Tracking | ✅ Custom scripts | ✅ SDK methods |
| User Identification | ✅ Custom scripts | ✅ SDK methods |
| Session Tracking | ✅ Automatic | ✅ Automatic |
| UTM Tracking | ✅ Automatic | ✅ Automatic |
| Click ID Tracking | ✅ Automatic | ✅ Automatic |
Management Features
| Feature | Container | Direct |
|---|---|---|
| Dashboard Management | ✅ Yes | ❌ Code only |
| Instant Updates | ✅ Yes | ❌ Needs deployment |
| Conditional Loading | ✅ Built-in | ⚠️ Manual coding |
| Trigger System | ✅ GTM-like triggers | ⚠️ Manual coding |
| Variable System | ✅ Built-in variables | ⚠️ Manual coding |
| A/B Testing | ✅ Easy | ⚠️ Manual setup |
Technical Features
| Feature | Container | Direct |
|---|---|---|
| SPA Support | ✅ Automatic | ⚠️ Manual setup |
| SSR Support | ❌ Client-side only | ✅ Full support |
| TypeScript | ⚠️ Via window.DATALYR | ✅ Full types |
| Mobile Apps | ❌ Not supported | ✅ Native SDKs |
| CSP Support | ✅ With nonce | ✅ With nonce |
| Offline Queue | ⚠️ Per-script basis | ✅ Built-in |
Code Examples
Container Installation
Install once, manage everything from dashboard:- Meta Pixel
- TikTok Pixel
- Google Tag
- Custom tracking scripts
- Third-party widgets
Direct Installation
Install base tracking:Using Both Together
You can use both Container and Direct installation:- Direct tracking provides attribution and base events
- Container manages all your pixels and custom scripts
- Best of both worlds
Migration
From Direct to Container
- Install container script alongside direct tracking
- Recreate your pixels as container tags
- Test that both work together
- Remove hardcoded pixels from code
- Keep direct tracking script for attribution
From Container to Direct
- Note all active container tags
- Install direct tracking script
- Manually add each pixel to your codebase
- Test that direct tracking works
- Remove container script
Decision Framework
Start with these questions:-
How often do you update tracking?
- Monthly or more → Container
- Rarely → Direct
-
Who manages tracking?
- Marketers → Container
- Developers only → Direct
-
How many tracking tools?
- 3+ platforms → Container
- 1-2 platforms → Direct
-
Do you need SSR?
- Yes → Direct
- No → Either works
-
Do you run A/B tests?
- Yes → Container
- No → Either works
-
Is 100ms page load critical?
- Yes → Direct
- No → Either works
Recommendations
For Most Sites: Container
Container is recommended for:- 80% of websites
- E-commerce stores
- Marketing-heavy sites
- SaaS platforms
- Agency-managed sites
For Performance Sites: Direct
Direct installation is better for:- High-traffic sites (millions of pageviews)
- Performance-critical applications
- Server-side rendered apps
- Sites with stable tracking
For Mobile Apps: Native SDKs
Use native SDKs (not Container):- iOS apps:
@datalyr/swift - React Native:
@datalyr/react-native - Flutter: Custom implementation
Next Steps
Install Container
Set up Container tag management
Install Direct Tracking
Install tracking script directly
Managing Tags
Create your first container tag
Container Overview
Learn more about Container