IntegrationsWordpress
WordPress Plugin
WordPress and WooCommerce plugin for easy analytics integration
WordPress Plugin
The @entro314labs/entrolytics-wp plugin provides seamless analytics integration for WordPress and WooCommerce sites with WooCommerce support.
Installation
Download Plugin
Download the latest release from GitHub.
Upload to WordPress
- Go to Plugins → Add New → Upload Plugin
- Choose the downloaded ZIP file
- Click Install Now
- Click Activate Plugin
Configure Settings
- Go to Settings → Entrolytics
- Enter your Website ID
- (Optional) Enter custom host for self-hosted instances
- Click Save Changes
Configuration
Basic Settings
Go to Settings → Entrolytics in your WordPress admin:
| Setting | Description |
|---|---|
| Website ID | Your Entrolytics website ID (required) |
| Custom Host | Custom analytics host (optional, for self-hosted) |
| Track Admin | Enable tracking for logged-in administrators |
| Track Logged-in Users | Track authenticated users |
Advanced Settings
| Setting | Description |
|---|---|
| Exclude Paths | Comma-separated list of paths to exclude |
| Track Outbound Links | Automatically track external link clicks |
| Track File Downloads | Track PDF, ZIP, and other file downloads |
| Enable WooCommerce | Track e-commerce events |
WooCommerce Integration
WooCommerce integration requires WooCommerce 8.0+ to be installed and activated.
When enabled, the plugin automatically tracks:
- Product views
- Add to cart events
- Checkout started
- Purchases (with revenue tracking)
- Category browsing
Tracked Events
| Event | Description | Data Tracked |
|---|---|---|
product_view | User views a product | Product ID, name, price, category |
add_to_cart | User adds item to cart | Product ID, quantity, price |
checkout_started | User initiates checkout | Cart total, item count |
purchase | Order completed | Revenue, currency, order ID, products |
category_view | User browses category | Category name, product count |
Custom Tracking
PHP Functions
Track custom events in your theme or plugins:
<?php
// Track custom event
if (function_exists('entrolytics_track')) {
entrolytics_track('button_click', [
'button_id' => 'hero-cta',
'page' => get_the_title()
]);
}
// Identify user
if (function_exists('entrolytics_identify') && is_user_logged_in()) {
$user = wp_get_current_user();
entrolytics_identify($user->ID, [
'email' => $user->user_email,
'username' => $user->user_login,
'role' => implode(',', $user->roles)
]);
}
// Track page view (manually)
if (function_exists('entrolytics_page_view')) {
entrolytics_page_view([
'url' => $_SERVER['REQUEST_URI'],
'title' => get_the_title()
]);
}Shortcodes
Track events with shortcodes:
<!-- Track button click -->
[entrolytics_track event="download_brochure" data='{"format":"pdf"}']
Download Brochure
[/entrolytics_track]
<!-- Conditional tracking -->
<?php if (is_user_logged_in()): ?>
[entrolytics_track event="member_only_view"]
Member Content
[/entrolytics_track]
<?php endif; ?>JavaScript API
Track events from JavaScript:
// Track event
if (window.entrolytics) {
window.entrolytics.track('video_play', {
video_id: 'intro-video',
duration: 120
})
}
// Identify user
if (window.entrolytics && wpData.userId) {
window.entrolytics.identify(wpData.userId, {
membershipLevel: 'premium'
})
}Hooks and Filters
Privacy & GDPR
The plugin is GDPR-compliant and includes:
- Cookie less tracking by default
- Option to respect Do Not Track
- Option to anonymize IP addresses
- No personal data stored locally
- Easy integration with consent management plugins
Cookie Consent Integration
<?php
// Only track after consent
add_filter('entrolytics_should_track', function($should_track) {
// Check your consent plugin
if (!function_exists('has_analytics_consent')) {
return $should_track;
}
return has_analytics_consent();
});Multisite Support
The plugin is multisite-compatible:
- Network-wide activation supported
- Per-site configuration
- Centralized settings for network admin
- Individual website IDs per site
Troubleshooting
Requirements
- WordPress
>= 5.8 - PHP
>= 8.1 - WooCommerce
>= 8.0(optional, for eCommerce tracking)
Features
- ✅ Automatic page view tracking
- ✅ WooCommerce integration
- ✅ Custom event tracking via PHP/JavaScript
- ✅ Shortcode support
- ✅ Hooks and filters for customization
- ✅ GDPR-compliant
- ✅ Multisite support
- ✅ Zero configuration for basic setup