Open edX web analytics with Matomo

Matomo is added to Open edX pages by injecting its tracking code into a comprehensive theme's templates, so the analytics stay in your infrastructure. This page covers the method, the setup sequence, the privacy decisions and how Matomo differs from Aspects learner analytics.

On this page

How to add Matomo analytics to Open edX pages

To add Matomo to Open edX pages, place the Matomo tracking code in head-extra.html, body-initial.html or body-extra.html inside a comprehensive theme, as the Open edX analytics docs describe. Open edX renders these template files on each page, so the snippet loads on every page that uses that theme. This is template injection: the tracking code lives in the theme's templates, and no connector or plugin is involved. The Open edX guide to configuring site-wide analytics tools walks through the Matomo case and shows how the same templates can hold other tools. Read it before editing any template, because the file you choose determines where the script loads.

Choose the injection point with care. head-extra.html places the script inside the document head, which suits tracker code that must start before the page finishes rendering. body-initial.html and body-extra.html place markup at the start and end of the body. Confirm the placement with your Matomo administrator, and confirm which sites and pages the theme serves, because the snippet only loads where that theme is active. Also confirm that every page you need to measure is rendered from these templates. React micro-frontends may not pass through them, so those pages could be missing from your Matomo reports until you check them separately.

Verify the result before you rely on it. Load a learner page and a staff page in a private browser window, then check Matomo's real-time view for visits under the site ID you expect. Confirm that page titles and URLs are recorded as you intend, and use the browser's network panel to confirm that tracker requests go only to your Matomo host. Make the change in version control and test it in a staging environment first, since a template error can break every page that uses the theme. Record the tracker, its site ID and the date it was added in your change log so your compliance reviewers can trace what runs on the site and when it was introduced.

What you need before adding Matomo to Open edX

Adding Matomo is a template change in the theme, but it depends on several decisions and checks made first. The cards below cover the hosting, theme, release, people and scope questions to settle before anyone edits a template or turns on tracking.

A Matomo instance you control

Matomo must run on servers or cloud accounts your team controls, reachable from the LMS pages your learners load. Settle where it runs, how it is backed up, and which site ID the Open edX site will report under. Confirm the Matomo version and its hosting requirements in the Matomo documentation and against your own environment before you plan the rollout, since this guide does not fix a version.

A comprehensive theme that applies

Open edX loads other analytics tools through the head and body hooks (head-extra.html, body-initial.html and body-extra.html) of a comprehensive theme, so the Matomo snippet runs only if your deployment applies that theme. Check that Tutor serves this theme on the LMS and that a rendered page includes the hook output. A theme that sits in the repository but is not the one served can quietly produce no tracking.

Analytics tools docs

Access to edit and redeploy

The team that adds Matomo needs write access to the theme repository, the Tutor configuration that builds the platform, and a deployment path that rolls the change to each environment. Confirm who edits templates, who approves the redeploy, and how a change is tested in staging before production. Without redeploy rights, the snippet stays in a branch and no learner ever loads it.

Open edX release and Tutor version

Record the Open edX release and the Tutor version your platform runs, and confirm both on the running environment, not only in the repository. Open edX supports only its latest named release, and Verawood is the current named release, with Willow listed for December 2026. Confirm whether an upgrade is planned before Matomo goes live, because template hooks can change between releases.

Open edX release notes

A named owner for privacy

One named person must own the decisions Matomo raises: what is tracked, how IP addresses are handled, whether consent is requested before tracking starts, how long data is kept, and who can read the reports. Engineers can implement these settings, but they should not decide them alone. Name the owner before the snippet is written, and record each decision where your compliance evidence is kept.

Scope against Aspects

Matomo measures web page traffic from the templates it is added to, while Aspects captures tracking logs as xAPI statements, stores them in ClickHouse, and presents them in Superset dashboards. Decide which questions each tool answers before you add Matomo, so course teams do not expect Matomo to report learner progress. Matomo and Aspects answer different questions, and the scope decision should be written down before the build.

Where a learner page view leaves the browser

The diagram starts with a learner's browser requesting a page from the Open edX LMS. The page is rendered from a comprehensive theme, and the template carries the Matomo snippet in head-extra.html, body-initial.html or body-extra.html. Once the page loads, the snippet sends a tracking request from the browser to the self-hosted Matomo server. The organization network box marks where that data moves from the learner's device into your infrastructure. When you review the setup, check which template holds the snippet, which Matomo host receives the request, and whether that host sits inside your network.

Page request, theme-rendered snippet and tracking request across the browser boundary.

Configuring Matomo tracking in the Open edX theme

This sequence takes a Matomo site from creation to a verified tracking snippet on the Open edX LMS. Each step closes with a check you can record, so the team knows whether to continue. The work happens in your theme repository and deployment pipeline, and each step should be confirmed against the Open edX documentation for your named release before you apply it.

  1. Create or confirm the Matomo site

    An administrator in Matomo creates a website entry for the learning platform, or confirms an existing one, and records its numeric site ID. Use one site per environment, such as staging and production, so test traffic stays out of production reports. Set the site URL to the LMS domain that learners use. Check: the site appears in the Matomo site list, the site ID is written into your configuration notes, and the tracking code page for the site opens in the Matomo interface.

  2. Prepare and review the tracking snippet

    Copy the tracking code for the site from the Matomo interface and insert your site ID and Matomo host into it. Treat the result as code: a second engineer reads it, confirms that it loads from your own Matomo host, and checks that it sends no personal data or user identifiers that your privacy review has not approved. Store the reviewed snippet in version control so later edits go through review. Check: the snippet is committed, and the reviewer's approval is recorded in the pull request.

  3. Add the snippet to the comprehensive theme

    In the comprehensive theme repository, place the reviewed snippet in one template file chosen from the analytics options in the Open edX docs: head-extra.html, body-initial.html or body-extra.html. Record the reason for the choice, because it determines where the script loads and which pages inherit it. Confirm in the Open edX docs on configuring site-wide analytics tools which templates render on the LMS and which on Studio, since the theme may apply to both. Check: a local build of the theme renders the snippet once in the page source of an LMS page.

  4. Apply the theme and redeploy

    Apply the theme in the target environment, starting with staging, through your Tutor configuration and image build process. Confirm the exact commands and theme settings against the Open edX docs for your release before running them, because the procedure may differ between releases. Redeploy the LMS and confirm that the new theme image is the one running. Keep a record of the previous image so the team can roll back if the snippet causes problems. Check: staging serves the new theme version, and the snippet appears in the LMS page source for a signed-out visitor.

  5. Verify visits arrive from the LMS

    Open the LMS in a browser that allows analytics requests, load several pages as a learner and as a staff member, then open the visits report for the site in Matomo. Look for visits whose page URLs point to your LMS domain and check that the page titles match the pages you loaded. Ad blockers and private browsing settings can hide visits, so run this check in a clean browser profile too. Repeat the check in production after release. Check: each page you loaded appears with the expected URL under the correct site ID.

  6. Confirm the snippet is absent elsewhere

    Decide in writing which pages will not be tracked, such as account, enrollment or other sensitive pages, and list any surfaces outside the LMS that share the theme. Load each excluded page and view its source to confirm the Matomo snippet is missing. If the theme applies to excluded pages, add template logic that skips the snippet, and confirm that approach against the Open edX docs for your release before deploying it. Check: the written list of excluded pages matches the source review, and no excluded page contains the snippet.

Where the Matomo snippet goes: head, body start or body end

Place the snippet in head-extra.html when the tracker should be declared before the page body is processed. This template is the natural home for scripts that other page code may expect to find early, and it keeps the tracker in one predictable spot across pages.

  • Load timing: The script is requested before body content is processed, so it is usually the earliest point at which the tracker can start. Confirm the actual order in the HTML your theme renders.
  • Blocking risk: A slow or unreachable Matomo server can delay rendering if the tag loads synchronously. Ask your Matomo administrator whether the tracker loads asynchronously.
  • Missed page view: If the tracker code fails before the page finishes loading, the view can disappear without any visible error for the learner.
  • Duplicate tags: Check that a base template and a child template do not both inject the snippet, which would count one visit twice.

View the source of the login page, a course outline and a Studio page, and confirm the Matomo script appears once inside the head element on each. Review the placement guidance in Configuring Site-Wide Analytics Tools before you rely on it.

What Matomo receives from Open edX pages

This table maps each Matomo concept to the Open edX source that produces it and to what the integration sends. Read it as the inventory to review before go-live: page URLs and basic browser data are the default, and anything beyond them, including custom variables, events or identifiers tied to learner accounts, must be added and reviewed deliberately.

Matomo conceptOpen edX sourceWhat the integration sends
Page viewRendered LMS page, with the Matomo snippet injected through the comprehensive theme's head or body templatesPage URL and page title of each rendered page where the snippet loads
VisitorBrowser cookie written by the Matomo tracker on the learner's or staff member's browserPseudonymous visitor ID; linking it to a named account needs a deliberate addition
Site IDTracker configuration in the theme templateThe Matomo site ID for this platform, set once in the template and matched to the site in Matomo
ReferrerBrowser referrer for each page loadReferring URL as the browser reports it for that page load
Custom variable or eventAdded by the team in theme templates or page JavaScript, only if the team builds itNothing by default; each custom variable or event needs a documented purpose and privacy review
Consent stateConsent banner in the theme, which the team connects to the trackerThe consent outcome the banner records; confirm the tracker waits for consent before it sends data
Browser dataUser agent and screen details the browser reports during the page loadBasic device and browser fields the tracker reads by default; confirm them against your Matomo version

Privacy and security controls for Matomo on Open edX

Matomo gives you control over where analytics data goes and what it contains, but the Open edX theme decides when the script runs and which values reach it. The six controls below cover consent, identifiers, change control, template access, hosting and retention, and each one needs an owner in your organization. Privacy obligations depend on your jurisdiction, so have your compliance owner confirm which of these controls the law requires and how each should be set.

Decide whether consent gates the script

The Matomo snippet can load on every page as soon as the theme renders, or it can wait until the learner's consent state allows it. Decide which behavior your organization needs before the snippet goes into head-extra.html or body-extra.html, and record the answer with the compliance owner. Check in a private browser session that no request reaches the Matomo host until consent is given, and that refusing it stops the calls.

Analytics configuration guide

Keep identifiers out of URLs

Course paths and learner usernames often appear in page URLs, and Matomo stores the page address it receives. Pass only the page category or a generic label into any custom variable, and check that the tracker does not send user IDs, email addresses or enrollment details. Open a course page with a test account, then inspect the tracking requests to confirm what leaves the browser.

Review the snippet like theme code

The tracking snippet is theme code, so it belongs in the same repository, branch and review process as the rest of the comprehensive theme. Store the Matomo site ID and host in reviewed configuration, and keep any change to them on a pull request. Tie each deployment to a commit so auditors can see which snippet ran on a given date. Ask the compliance owner which change record must accompany a tracking change.

Limit who edits theme templates

Anyone who can edit a comprehensive theme can add a script to every page, including pages that show learner data. Restrict write access to the repository and to the Tutor environment that builds the theme, and require a second reviewer for changes to head or body templates. Review the access list at each platform upgrade, because the people who maintained the theme may have changed roles.

Host Matomo inside the approved network

Matomo and its database should run in the cloud account, data center or network segment your privacy and security owners have approved, so tracking data never leaves that boundary. Confirm which hostname the browser calls, because a public Matomo host outside the boundary still receives every page view. Ask the database team for backups, encryption at rest and access logs on the Matomo database, and include them in the same review as the LMS.

Set retention in Matomo

Matomo keeps raw visit data and aggregated reports, and each has its own retention behavior that you configure in Matomo's administration settings. Decide how long raw logs and reports should exist, delete old raw data on that schedule, and document the choice in your data inventory. Check the options in your installed Matomo version, because settings and defaults change between releases, and confirm the period with the compliance owner.

Why Matomo shows no data or the wrong pages

This table lists the most common reasons Matomo shows no data or the wrong pages on an Open edX site, with the likely cause and fix for each. Work through the rows in order, starting with theme and template checks, because most gaps trace back to which template renders the snippet. Verify every fix in a staging environment before changing production, then confirm that a test visit appears in the correct Matomo site.

SymptomLikely causeFix
No Matomo requests on LMS pagesThe snippet sits in a template the active theme does not override, so the default template renders insteadConfirm the file exists in the active theme's templates folder and that the page includes that hook
Default look and no tracking code in page sourceThe comprehensive theme is not applied to the site, so its templates never loadCheck the site's theme assignment, reload a page, and confirm the theme's markup appears in the page source
Data appears in another Matomo site or in noneThe site ID in the tracker code does not match the Matomo site for this domainCompare the setSiteId value with the site ID in Matomo's website settings, and use one Matomo site per domain
Old tracker code or template changes still showingA stale build, static asset cache or CDN still serves the previous pageRebuild and restart the affected services, clear CDN or cache entries, then hard-reload the page in a private window
Browser console shows a blocked script or request to MatomoThe content security policy does not allow the Matomo host for scripts or connectionsAdd the Matomo host to the platform's allowed script and connection sources, then retest each affected page
Low counts, with no requests when a blocker is onAd blockers or browser privacy settings suppress requests to the Matomo hostTest with blockers enabled to measure the gap, then decide with privacy staff whether a first-party endpoint fits
Micro-frontend pages such as dashboards or course views are untrackedMicro-frontend pages are React apps that do not render the LMS Django templates you editedConfirm the supported injection point for each micro-frontend in your release, add tracking there, and test each route

What Matomo measures compared with Aspects learner analytics

Matomo measures what the browser reports. Once its tracking code is placed in a comprehensive theme through the head or body templates, such as head-extra.html, body-initial.html or body-extra.html, it records page views, visit patterns, referrers and similar browser-level signals for each page that carries the tag. That makes it a good fit for questions about the public catalog, marketing pages, landing pages and how visitors arrive. It does not describe what a learner did inside a course unit unless you add custom event tracking, so the first check is which Open edX templates load the tag. The template hooks and the Matomo example are covered in the Open edX documentation on configuring site-wide analytics tools.

Aspects starts from a different source. According to the Open edX Aspects documentation, its analytics capture tracking logs through the event-routing-backends plugin and convert them to xAPI statements. Those statements are stored in ClickHouse through Ralph or Vector, and Superset dashboards present them. The subject is learner and course activity as the platform records it, so Aspects is the tool to evaluate for course-level reporting and learner progress. Matomo does not replace that work, and Aspects does not replace the page-level traffic view. The two can run together, with each tool holding its own data and access settings, so a team should not treat one as a stand-in for the other.

Before you decide what each tool covers, confirm the Aspects setup and its data path with the Aspects overview. Check whether the event-routing-backends plugin is enabled in your deployment, which of Ralph or Vector handles ingestion in your release, and where ClickHouse and Superset run. Then write a short coverage map: traffic and referrer questions go to Matomo, and course progress and learner activity questions go to Aspects. Confirm the data path before anyone builds reports on either tool. Both tools hold personal data, so privacy review should cover each one's retention and access settings. Ask any implementation partner to demonstrate the path in your environment with sample events.

Questions buyers ask about Open edX and Matomo

What does adding Matomo to Open edX cost, and what drives it?

Cost comes from four parts: Matomo hosting, theme work, privacy review and testing, and whether your comprehensive theme already exists. Hosting is paid to whoever runs the Matomo instance, in your cloud, data center or a provider you choose, and it recurs. Theme work is a one-time build of the tracking code in the theme's head-extra.html, body-initial.html and body-extra.html files. If the theme already has a comprehensive structure, this work shrinks. If it does not exist yet, expect more build effort. Privacy review and testing cover what the pages send and how consent is handled. Ask any quote to price each line separately and to state which lines are one-time and which recur.

How long does a Matomo integration on Open edX take?

The duration is set by three inputs: whether your comprehensive theme can take the analytics snippets, how quickly your privacy owner decides what Matomo may collect, and how soon your team can test on a staging site. Theme creation is the largest variable if the theme must be built first. A new Matomo instance adds its own provisioning and access steps. Testing covers the LMS pages and any micro-frontend pages you rely on, across browsers and consent choices. Confirm which Open edX release your site runs, because the theme must match it. Verawood is the current named release, published on 30 July 2026, and the next releases are listed for December 2026 and June 2027. Ask for a timeline written against these inputs.

What must our organization provide before Matomo work starts?

Four inputs are needed before work starts, and each one should have a named owner on your side:

  • Access to the Open edX server or Tutor configuration, the comprehensive theme repository and the deployment pipeline.
  • A Matomo instance you control, with a site ID and the administrator access needed to create the tracking site.
  • A privacy owner who can approve what the pages may send, how long data is kept and how consent is shown.
  • A test environment that matches production in Open edX release and theme, so changes can be checked before they reach learners.

Missing any of these usually delays the work more than the technical build itself. Put them in the written scope so the start date depends on known inputs.

Can our in-house team add Matomo to Open edX without a partner?

Yes, an in-house team with Open edX theme and Tutor experience can add Matomo alone, because the change lives in a comprehensive theme's template files and is deployed through the same process as other theme edits. The skills to confirm are template editing, redeploying through Tutor and checking pages in a staging environment. The harder parts are the privacy decisions and the consent behavior, which need input from people outside engineering. Teams that lack Open edX theme experience often find the first upgrade cycle the most demanding. If you want outside help, DeployOpen can implement the integration and run security testing under a written scope, and the Open edX analytics documentation is the natural first read for your team.

Does Matomo replace Aspects learner analytics in Open edX?

No, Matomo does not replace Aspects. Matomo is a self-hosted web analytics tool that the theme connects to your pages, similar in role to other site-wide tools that can sit beside Google Analytics. Aspects is the learner analytics pipeline. It captures tracking logs through the event-routing-backends plugin as xAPI statements, stores them in a ClickHouse database through Ralph or Vector, and presents them in Superset dashboards. Page-level traffic questions usually belong to Matomo, while course activity and learner progress questions usually belong to Aspects. Running both means two data stores to host, secure, back up and review for privacy, so confirm which questions each tool must answer before you choose.

What recurs after a Matomo launch on Open edX?

Matomo needs ongoing upkeep after launch. Each new Open edX release can change the templates your theme overrides, so the analytics snippets must be checked on every upgrade. Open edX states that the latest named release is the only supported release, so your site will move through each new release in turn, with Verawood current and Willow and Xylon listed next. Matomo also releases updates to your self-hosted instance that you must apply and test. Hosting cost recurs, and so does a periodic review of consent behavior and what the pages send. Ongoing support, upgrades and continuous testing can be covered by a retainer, which you should price against a written scope.

How DeployOpen scopes and delivers Matomo on Open edX

DeployOpen plans, implements and supports self-hosted Open edX in your own infrastructure, including the theme changes that place a Matomo tag on learner pages. The work starts with the templates, consent position and Matomo instance that will receive data, then builds and tests the change in a staging platform. Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we scope

  • Written scope lists which Open edX pages and templates will load the Matomo tag, such as head-extra.html or body-extra.html.
  • Scope records which Matomo site IDs, event types and tracked pages are in and out, agreed before build starts.
  • Scope also settles whether Matomo page measurement is enough, or whether Aspects xAPI pipelines are needed for learner analytics.

How we build

  • Build the snippet into a comprehensive theme repository, so changes are versioned and reviewed.
  • Test tracking in a staging Open edX with Tutor, confirming the Matomo request fires on each in-scope page.
  • Confirm the Matomo host and its backups are in infrastructure you control, and record them in the scope.

How we hand over

  • Hand over the theme change, a tracking test record and notes for both the Open edX and Matomo sides.
  • Document which pages send data, which settings were changed and how to roll back the theme change.
  • Walk your compliance and privacy staff through the consent setting and data flows so they can review them.

How we support

  • Ongoing support is available as a retainer, covering upgrades and checks that Matomo tracking still fires.
  • Re-test tracking after each Open edX or theme change, so gaps in reporting are caught early.
  • Changes to scope after signing go through a written change to the agreed scope before work starts.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.