Introduction
This guide covers installing ServerTrack on WordPress websites. Whether you're using WooCommerce, other plugins, or a custom theme, ServerTrack can be easily integrated into any WordPress site.
Best Method: Use the ServerTrack WordPress plugin for the easiest and most reliable installation. Manual installation is also available.
Method 1: Using ServerTrack WordPress Plugin (Recommended)
The easiest way to install ServerTrack on WordPress is using our official plugin:
Step 1: Download the Plugin
- Download the ServerTrack WordPress plugin from your dashboard or our website
- Save the plugin ZIP file to your computer
Step 2: Upload and Activate Plugin
- Log in to your WordPress Admin Dashboard
- Navigate to Plugins → Add New
- Click "Upload Plugin" button at the top
- Click "Choose File" and select the ServerTrack plugin ZIP file
- Click "Install Now"
- After installation, click "Activate Plugin"
Step 3: Configure the Plugin
- Go to Settings → ServerTrack in WordPress admin
- Enter your Authentication Key from your ServerTrack dashboard
- (Optional) Enter your custom tracking domain if configured
- Click "Save Settings"
The plugin will automatically add the tracking script to all pages of your WordPress site.
Method 2: Manual Installation via Theme Editor
If you prefer manual installation or don't want to use the plugin:
Step 1: Access Theme Editor
- Log in to WordPress Admin Dashboard
- Navigate to Appearance → Theme Editor
- Select Header (header.php) from the file list on the right
Step 2: Add Tracking Script
- Find the
</head>tag in the header.php file - Copy your ServerTrack tracking script from your ServerTrack dashboard (Installation section)
- Paste the script just before the
</head>tag - Click "Update File" to save
Warning: Theme edits will be lost if you update your theme. Use a child theme or the plugin method for a permanent solution.
Method 3: Using functions.php (Child Theme)
For a more permanent solution that survives theme updates:
- Create a child theme (if you haven't already)
- Open your child theme's
functions.phpfile - Add this code at the end:
function servertrack_tracking_script() {
$auth_key = 'YOUR_AUTHENTICATION_KEY_HERE';
$tracking_url = 'https://YOUR-DOMAIN.com/tracker.js'; // or default URL
?>
<script>
(function(w, d, u, k) {
w.ServerTrack = w.ServerTrack || {};
w.serverTrackQueue = [];
w.st = function() { w.serverTrackQueue.push(arguments); };
var s = d.createElement('script'); s.async = 1;
s.src = u + '?key=' + k;
var h = d.getElementsByTagName('script')[0]; h.parentNode.insertBefore(s, h);
})(window, document, '<?php echo esc_js($tracking_url); ?>', '<?php echo esc_js($auth_key); ?>');
</script>
<?php
}
add_action('wp_head', 'servertrack_tracking_script');
- Replace
YOUR_AUTHENTICATION_KEY_HEREwith your actual Authentication Key - Replace
YOUR-DOMAIN.comwith your tracking domain (or use default) - Save the file
Verifying Installation
After installation, verify it's working:
1. Check Script Loads
- Visit your WordPress website
- Open Developer Tools (F12 or Right-click → Inspect)
- Go to the Network tab
- Refresh the page
- Look for requests to
tracker.jsor your ServerTrack domain - The request should return status 200 (success)
2. Check Browser Console
- Open Developer Tools (F12)
- Go to the Console tab
- Look for ServerTrack initialization messages
- There should be no red error messages related to ServerTrack
3. Test Event Tracking
- Trigger an event on your website (e.g., visit a page)
- Go to your ServerTrack dashboard
- Navigate to Event Logs
- You should see the event appear within a few seconds
WooCommerce Integration
If you're using WooCommerce, ServerTrack will work automatically once installed. For detailed WooCommerce-specific setup, see our WooCommerce Installation Guide.
Plugin Settings
If using the ServerTrack WordPress plugin, you can configure:
- Authentication Key: Your ServerTrack tracking key
- Tracking Domain: Custom domain (if configured)
- Enable on Admin: Whether to track admin pages (usually disabled)
- Debug Mode: Enable for troubleshooting
Best Practices
- Use the Plugin: Plugin installation is the most reliable and update-safe method
- Use Child Theme: If editing theme files, always use a child theme
- Test Before Going Live: Test tracking on a staging site first
- Keep Plugin Updated: Update the plugin when new versions are released
- Backup Before Changes: Always backup your site before making changes
Troubleshooting
Script Not Loading
- Verify plugin is activated
- Check Authentication Key is correct in plugin settings
- Clear WordPress cache (if using caching plugins)
- Check browser console for JavaScript errors
Events Not Tracking
- Verify Server Deck status is "Active"
- Check Event Logs in ServerTrack dashboard
- Ensure platform configurations (Facebook, TikTok, GA4) are set up
- Test with a simple page view event
Plugin Conflicts
- Deactivate other tracking plugins temporarily to test
- Check for JavaScript errors in browser console
- Ensure no other scripts are blocking ServerTrack
Summary
Installing ServerTrack on WordPress is straightforward:
- Recommended: Use the ServerTrack WordPress plugin (easiest and most reliable)
- Alternative: Manual installation via theme editor or functions.php
- Configure with your Authentication Key
- Verify installation is working
- Test event tracking
The plugin method is recommended as it automatically handles script placement, survives theme updates, and provides an easy configuration interface.
For more information, see our WooCommerce-specific guide or our general Installation Guide.