Skip to main content

Integrating Nextcloud Hub 28 with Matomo Analytics

This article outlines the steps to connect your self-hosted Nextcloud instance (v33.0.0+) to Matomo for tracking user activity and file browsing.


1. Prerequisites

  • Matomo Site ID: Ensure you have created a "Measurable" for Nextcloud. For this setup, theĀ Site ID is 3.
  • Nextcloud Version: Hub 28 Winter (v33.0.0).
  • App Version: Matomo Tracking (v1.0.0).

2. Matomo Configuration

  1. Log in to your Matomo instance at https://matomo.goonersnas.com/.
  2. Navigate to Administration (Cog Icon) > Websites > Manage.
  3. Verify that the URL for Site ID 3 is set to https://nc.goonersnas.com/.

3. Nextcloud App Installation

  1. Log in to Nextcloud as an Administrator.
  2. Go to Apps and select the Integration category.
  3. Search for "Matomo Tracking".
    • Note: Avoid the legacy "Piwik" version (v0.13.0) as it is incompatible with v33.
  4. Click Download and enable (you may need to click "Allow untested app").

4. Connection Settings

  1. Navigate to Administration settings > Additional settings.
  2. Locate the Matomo Tracking section.
  3. Enter the following details:
Matomo Server Url: https://matomo.goonersnas.com/ Site ID: 3 [x] Track file browsing [x] Track user id

Note: Ensure the URL includes the trailing slash. Settings save automatically upon losing focus from the text fields.


5. Verification

  1. Open Nextcloud in an Incognito/Private browser window and navigate through a few folders.
  2. Return to Matomo and go to Dashboard > Real-time > Visitor Log.
  3. Look for active visits originating from your Nextcloud domain.

6. Troubleshooting & Security

Content Security Policy (CSP)

If tracking fails to report, you may need to whitelist your Matomo domain in the Nextcloud config.php file:

'custom_csp_policy' => "default-src 'self'; script-src 'self' https://matomo.goonersnas.com; img-src 'self' data: https://matomo.goonersnas.com; connect-src 'self' https://matomo.goonersnas.com;",

Nginx Proxy Manager

Ensure that your Matomo proxy host does not have "Block Common Exploits" enabled if it interferes with the tracking .js delivery to external subdomains.