This guide covers how to integrate analytics and marketing tools with Kentico Xperience, a .NET-based enterprise digital experience platform (DXP).
Available Integration Guides
Google Analytics 4 (GA4)
- GA4 Setup - Install and configure GA4 on Kentico
- Event Tracking - Implement custom event tracking
- E-commerce Tracking - Track transactions with Kentico E-commerce
Google Tag Manager (GTM)
- GTM Setup - Install GTM on Kentico sites
- Data Layer Implementation - Build robust data layers for Kentico
Meta Pixel
- Meta Pixel Setup - Install Facebook Pixel on Kentico
- Event Tracking - Track conversions and events
Kentico Development Models
Kentico supports multiple development approaches that affect how you implement tracking:
MVC Development Model (Kentico 12+)
The modern approach using ASP.NET MVC pattern:
- Separate presentation and business logic
- Use controllers and views for rendering
- Implement tracking in layout files or partial views
- Better performance and testability
Portal Engine (Legacy)
The original drag-and-drop development model:
- Web Parts and widgets for page building
- Master pages for templates
- Web Part zones for content placement
- Macro expressions for dynamic content
Page Builder (Kentico 13+)
Modern content editing experience:
- Drag-and-drop page composition
- Widgets for reusable components
- Section-based layouts
- Inline editing capabilities
Common Integration Points
Master Page / Layout Files
The primary location for global tracking code:
- MVC:
~/Views/Shared/_Layout.cshtml - Portal Engine: Master page templates
- Add tracking code in
<head>or before</body>
Web Analytics Module
Kentico's built-in analytics system:
- Page views and visitor tracking
- Conversion tracking
- Campaign tracking
- Can coexist with third-party analytics
Custom Modules and Web Parts
For advanced implementations:
- Create custom modules for tracking logic
- Build reusable Web Parts for consent management
- Implement server-side tracking when needed
Integration Considerations
Content Staging
- Test tracking on staging before production deployment
- Use macro conditions to exclude tracking on staging:
{% raw %}{% CurrentSite.SiteName == "ProductionSite" %}{% endraw %}
Multi-Site Management
- Configure tracking per site
- Use site-specific settings for tracking IDs
- Implement site-aware data layer variables
Performance Optimization
- Load scripts asynchronously when possible
- Use Kentico's output caching
- Minimize impact on Core Web Vitals
- Consider using Tag Manager for better control
Privacy and Consent
- Integrate with Kentico's cookie consent features
- Implement GDPR-compliant tracking
- Use OneTrust or Cookiebot for consent management
- Conditionally load tracking based on consent
Macro Expressions
Kentico macro expressions allow dynamic content in templates:
// Get current page name
{% raw %}{% CurrentDocument.DocumentName %}{% endraw %}
// Get site name
{% raw %}{% CurrentSite.SiteName %}{% endraw %}
// Conditional rendering
{% raw %}{% if(CurrentSite.SiteName == "ProductionSite") { "<!-- Production -->" } %}{% endraw %}
// User information
{% raw %}{% CurrentUser.Email %}{% endraw %}
Best Practices
Use Layout Files for Global Code - Add tracking scripts to master pages or layout files for site-wide implementation
Leverage Kentico Settings - Store tracking IDs and configuration in Kentico settings for easy management
Test in Staging - Always test implementations in staging environment before deploying to production
Document Customizations - Keep records of custom code and integration points for future developers
Monitor Performance - Track Core Web Vitals and optimize script loading
Implement Consent Management - Ensure compliance with privacy regulations
Use GTM When Possible - Google Tag Manager provides flexibility without code deployments
Next Steps
Choose an integration guide based on your needs:
- Start with GTM Setup for the most flexible approach
- Go directly to GA4 Setup for Google Analytics
- Review Meta Pixel Setup for Facebook advertising
For issues, see the Troubleshooting Guide.