Installing ServerTrack on WooCommerce

Last updated: January 30, 2026 • 7 min read

Complete guide to integrating ServerTrack with your WooCommerce WordPress store, including theme integration and plugin options.

Introduction

ServerTrack provides a WordPress plugin that makes installation on WooCommerce stores quick and easy. This guide covers installing ServerTrack using our official WordPress plugin.

Method: WordPress Plugin (Recommended) | Time Required: 5 minutes | Difficulty: Easy

Prerequisites

Before installing, ensure you have:

  • WordPress website with WooCommerce installed
  • ServerTrack account with verified tracking domain
  • Administrator access to your WordPress site
  • Your ServerTrack authentication key from the dashboard

Step 1: Install the ServerTrack Plugin

We provide an official WordPress plugin for easy integration:

Method 1: Upload Plugin

  • Download the ServerTrack WordPress plugin from your dashboard or our website
  • Log in to your WordPress admin panel
  • Go to PluginsAdd New
  • Click "Upload Plugin" at the top
  • Choose the plugin ZIP file and click "Install Now"
  • After installation, click "Activate Plugin"

Method 2: Manual Installation

  • Download the plugin ZIP file
  • Extract it to your computer
  • Upload the plugin folder to /wp-content/plugins/ via FTP
  • Go to WordPress admin → Plugins
  • Find "ServerTrack" and click "Activate"

Step 2: Configure the Plugin

  • After activation, go to SettingsServerTrack (or WooCommerce → ServerTrack)
  • Enter your ServerTrack settings:
    • Authentication Key: Your ServerTrack authentication key
    • Tracking Domain: Your verified ServerTrack domain (e.g., data.yoursite.com)
    • Enable Tracking: Check this box to enable tracking
  • Click "Save Settings"

Step 3: Configure Event Tracking

The plugin automatically tracks standard WooCommerce events:

  • ViewContent: When customers view product pages
  • AddToCart: When items are added to the cart
  • InitiateCheckout: When checkout is started
  • Purchase: When orders are completed

You can enable/disable individual events in the plugin settings.

Step 4: Test Installation

  • Visit your store's homepage
  • Open Browser Console (F12)
  • Type: window.st - you should see a function
  • Browse a product page - check ServerTrack logs for ViewContent event
  • Add a product to cart - check for AddToCart event
  • Complete a test purchase - check for Purchase event

Alternative: Manual Installation (Without Plugin)

If you prefer not to use the plugin, you can install ServerTrack manually:

  • Get your tracking script from ServerTrack dashboard
  • Add it to your theme's functions.php file:
    function add_servertrack_script() {
        ?>
        <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, 'https://data.yoursite.com/tracker.js', 'YOUR_AUTH_KEY');
        </script>
        <?php
    }
    add_action('wp_head', 'add_servertrack_script');
  • Then implement event tracking using WooCommerce hooks

Note: If using a child theme, always add code to the child theme's functions.php, not the parent theme. This prevents code loss during theme updates.

WooCommerce Event Hooks

If implementing events manually, use these WooCommerce hooks:

Purchase Event Hook

add_action('woocommerce_thankyou', 'track_purchase_event', 10, 1);
function track_purchase_event($order_id) {
    $order = wc_get_order($order_id);
    if (!$order) return;

    $userData = array(
        'em' => $order->get_billing_email(),
        'ph' => $order->get_billing_phone(),
        'fn' => $order->get_billing_first_name(),
        'ln' => $order->get_billing_last_name(),
        'ct' => $order->get_billing_city(),
        'country' => strtolower($order->get_billing_country())
    );

    $contents = array();
    foreach ($order->get_items() as $item) {
        $contents[] = array(
            'id' => (string)$item->get_product_id(),
            'quantity' => $item->get_quantity(),
            'item_price' => $item->get_subtotal() / $item->get_quantity()
        );
    }

    $eventData = array(
        'currency' => $order->get_currency(),
        'value' => $order->get_total(),
        'transaction_id' => (string)$order_id,
        'content_ids' => array_map(function($item) {
            return (string)$item->get_product_id();
        }, $order->get_items()),
        'contents' => $contents
    );

    echo "<script>st('track', 'Purchase', " . json_encode($eventData) . ", " . json_encode($userData) . ");</script>";
}

Troubleshooting

Plugin Not Found

  • Ensure you downloaded the correct plugin version for your WordPress version
  • Check that the plugin file isn't corrupted
  • Try downloading the plugin again

Events Not Tracking

  • Verify plugin settings are saved correctly
  • Check that tracking is enabled in plugin settings
  • Ensure your ServerTrack domain is verified
  • Check browser console for JavaScript errors
  • Review ServerTrack event logs for error messages

Next Steps

  • Configure platform integrations (Facebook, TikTok, GA4) in ServerTrack dashboard
  • Test events by completing a test purchase
  • Monitor event logs to ensure events are being sent correctly
  • Customize event tracking if needed using WooCommerce hooks

For more information, see our Tracking Purchase Events guide.

Was this article helpful?

Please log in to provide feedback on this article.