🔍 Can you go server-side with Matomo? Yes — here’s how.

Matomo is not only a privacy-first analytics platform. It’s also server-side ready.
Thanks to its Tracking HTTP API, you can send hits without JavaScript, directly from your server, Python script, or a server-side tag manager.

✅ Common use cases

🧩 Example of server-side HTTP request


GET https://matomo.mysite.com/matomo.php
  ?idsite=1
  &rec=1
  &url=https://mysite.com/thank-you
  &action_name=Order Confirmed
  &uid=123456
  &e_c=ecommerce
  &e_a=purchase
  &e_v=79.99

You can send this from any backend (PHP, Python, Node.js…), or even a server-side tag manager like GTM Server.

🔗 Reconciling client-side and server-side data

To make sure Matomo ties together what happens in the browser and what happens in your backend, you need a shared key.

👉 That key is uid (User ID).

🔧 What to do:

Client-side (JS or Tag Manager):

_paq.push(['setUserId', '123456']);

Server-side (HTTP request):

&uid=123456

🧠 Matomo will link all these actions under the same user profile, across sessions and channels.

⚠️ Without uid, your server-side hits will remain isolated and disconnected from frontend activity.


📌 Benefits of Matomo server-side tracking


🎯 In short

Matomo gives you a clean and powerful way to run server-side analytics — without relying on external scripts, and with full user data reconciliation via uid.

🧩 Python example: Sending a server-side hit to Matomo

import requests

MATOMO_URL = 'https://matomo.mysite.com/matomo.php'
SITE_ID = 1
USER_ID = '123456'  # Same UID as set client-side
EVENT_NAME = 'Server-side Order Confirmed'
EVENT_CATEGORY = 'ecommerce'
EVENT_ACTION = 'purchase'
EVENT_VALUE = 79.99

payload = {
    'idsite': SITE_ID,
    'rec': 1,
    'uid': USER_ID,
    'action_name': EVENT_NAME,
    'e_c': EVENT_CATEGORY,
    'e_a': EVENT_ACTION,
    'e_v': EVENT_VALUE,
    'url': 'https://mysite.com/thank-you',
    'ua': 'Python-Server-Agent/1.0',
}

response = requests.get(MATOMO_URL, params=payload)

if response.status_code == 200:
    print("✅ Matomo hit sent successfully.")
else:
    print(f"❌ Failed to send hit: {response.status_code}")

📌 Python example: how to send server-side data to Matomo

Here’s a basic Python script that sends an ecommerce purchase event directly to Matomo via the HTTP API.

The key things to note:

This can be part of a:

✅ If you already use _paq.push(['setUserId', '123456']) on the frontend, this hit will be merged under the same user in Matomo.

🧪 You can test the call in real time using Matomo’s “Real-time” dashboard.