Matomo Rocket.Chat Integration

Matomo Rocket.Chat Integration - Web App Analytics

Rocket.Chat has native features for connecting with Matomo Analytics (formerly Piwik). This provides metrics to help you better understand how users access your chat system, whether any malicious links are being shared internally, and more. Read on to learn more about the Matomo Rocket.Chat integration.

How to Configure the Matomo Rocket.Chat Integration

  1. Log into your Rocket.Chat instance. Ensure that the user you login as has Rocket.Chat admin privileges.
  2. Select the user icon in the upper-left corner, then “Administration.”
  3. On the left, scroll down and select “Analytics.”
  4. Select “Features Enabled” on the right. 
  5. Here you can toggle whether to track custom events related to actions a user does in messages, on a channel or group (create, leave, delete), and within user settings (password resets, profile picture changes, etc.).
    Rocket.Chat analytics features enabled
  6. Under the “Features Enabled” section, select “Piwik” (the former name of Matomo Analytics).
  7. Select the “Enabled” toggle switch to configure Matomo Rocket.Chat options. The color will update to blue.
    Matomo Rocket.Chat integration settings
  8. Add your Matomo Analytics instance URL with the trailing “/” at the end.
  9. Log into your Matomo app.
  10. Select “All Websites” on the top-right corner.
  11. Select “Add a new website.”
  12. Follow the setup instructions. The only settings you need to configure for now are “URLs” and “Time zone.” Select “Save” at the bottom once done.
    Example Rocket.Chat Measurable
  13. Once forwarded to the “Manage Measurables” page, you’ll see a Matomo site “ID” number under the website name. Type the ID number for Rocket.Chat in your Rocket.Chat web app under “Client ID.”
    Matomo Measurables page with client ID

    Keep Matomo open.
  14. If you have multiple Matomo instances you’d like to integrate, enter them in the “Additional Piwik Sites” text box.
  15. Enable “Prepend Domain” to use the full URL within Matomo analytics.
  16. Enable “All Subdomains” to track subdomains under your Rocket.Chat instance.
  17. In the “Hide Outgoing Links” section, add any internal URLs you don’t want to track.
  18. Select “Save changes” at the top-right corner.

Test Your Rocket.Chat Matomo Configuration

Browse a few pages within Rocket.Chat. Share some hyperlinks in the chatroom and open them. In Matomo, select “Dashboard” at the top. You should see some analytics for visitors and page URLs.

Matomo dashboard with analytics

How to Troubleshoot Rocket.Chat Matomo Integration Issues

Troubleshooting web analytics can be frustrating. Here are some tips to help you troubleshoot Matomo Rocket.Chat metrics.

First, ensure your Matomo dashboard is set to today’s calendar date at the top.

Matomo calendar selection

Modify Do Not Track (DNT) Browser Settings

Check if your browser sends Do Not Track (DNT). Matomo respects this browser setting by default. If it is enabled in your browser, disable it, refresh your chatroom, and navigate some more pages. Recheck Matomo. 

You can also disable Matomo from respecting DNT from Administration > Privacy > Users opt-out. We don’t recommend this for respect of General Data Protection Regulation (GDPR) compliance and user privacy in general.

Matomo Support Do Not Track preference

Disable Rocket.Chat Content-Security-Policy

On your local machine, check to see if something is blocking your Matomo JavaScript URL with the Developer Tools console tab. It may be blocked by the chat application’s Content Security Policy (CSP) header.

Firefox Content Security Policy error from Rocket.Chat
Matomo JavaScript URL blocked by Content-Security-Policy (CSP).

As of version 4.0.0, the easiest solution is to disable the application’s Content-Security-Policy (CSP). From the administration page, select “General” and disable the “Enable Content-Security-Policy” feature. 

As this is a valuable security feature, we recommend only disabling this if you truly need the analytics now and have taken additional steps to secure your Linux cloud server. Otherwise, you should first contact the Rocket.Chat development team about the best course of action for modifying the CSP to whitelist external scripts.

Contact our 24/7 Live Support if you encounter additional issues.

Experience full control over your server environment and deploy the best operating and management systems that fit your needs with our reliable Cloud VPS Hosting!

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!