# Matomo Analytics

**URL:** https://meta.discourse.org/t/matomo-analytics/33090
**Category:** Theme component
**Tags:** official, matomo-analytics
**Created:** [September 10, 2015, 10:18am UTC](https://meta.discourse.org/t/matomo-analytics/33090 "2015-09-10T10:18:13Z")
**Posts on this page:** 13
**Page:** 3

<div class="post-metadata">

### Author: ![shrey](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@shrey](https://meta.discourse.org/u/shrey)
#### Post date: [November 30, 2022, 8:47am UTC](https://meta.discourse.org/t/matomo-analytics/33090/78 "2022-11-30T08:47:46Z")

</div>

Is there any other (more direct) way of integrating Matomo with Discourse, instead of using the plugin?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [November 30, 2022, 8:51am UTC](https://meta.discourse.org/t/matomo-analytics/33090/79 "2022-11-30T08:51:45Z")

</div>

How’s the cron of **root** — there should be something like this:

```plaintext
*/12 * * * * /var/www/matomo/console core:archive --url=https://<home-of-matomo>/ > /var/log/apache2/matomo-archieve

```

(Of course time and logging are personal preferences, and path can and will be different)

But the sad story is this start to be out of scope of Discourse — your forum if sending data and Matomo gets it, is just doesn’t show it to you.

---

<div class="post-metadata">

### Author: ![shrey](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@shrey](https://meta.discourse.org/u/shrey)
#### Post date: [November 30, 2022, 9:12am UTC](https://meta.discourse.org/t/matomo-analytics/33090/81 "2022-11-30T09:12:56Z")

</div>

I’m not sure where the cron settings are, in this instance.  
Also, as i already have other websites being properly tracked, i would assume that Matomo’s general config is alright.

> [@Jagster](#):
>
> But the sad story is this start to be out of scope of Discourse — your forum if sending data and Matomo gets it, is just doesn’t show it to you.

Yeah, will head over to Matomo’s forum as well.  
Thanks for your inputs!

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [November 30, 2022, 9:29am UTC](https://meta.discourse.org/t/matomo-analytics/33090/82 "2022-11-30T09:29:44Z")

</div>

If it can track everything else then the issue is not cron. Or Matomo per se.

What happends if you stop using CSP, letting it only log?

---

<div class="post-metadata">

### Author: ![shrey](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@shrey](https://meta.discourse.org/u/shrey)
#### Post date: [November 30, 2022, 9:34am UTC](https://meta.discourse.org/t/matomo-analytics/33090/83 "2022-11-30T09:34:07Z")

</div>

If i disable CSP, i’m getting the same results.

Same logs, no error, no data.

---

<div class="post-metadata">

### Author: ![shrey](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@shrey](https://meta.discourse.org/u/shrey)
#### Post date: [November 30, 2022, 9:36am UTC](https://meta.discourse.org/t/matomo-analytics/33090/84 "2022-11-30T09:36:55Z")

</div>

Any idea about this?

> [@shrey](#):
>
> Is there any other (more direct) way of integrating Matomo with Discourse, instead of using the plugin?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [November 30, 2022, 9:45am UTC](https://meta.discourse.org/t/matomo-analytics/33090/85 "2022-11-30T09:45:57Z")

</div>

No idea, but you can give a try — put the code snippet on header and give a try.

Otherwise I have only one trick left: take a (coffee)break and double and triple check your settings in the component. It is so easy to not see obvious error, like wrong ID or misspelled host.

---

<div class="post-metadata">

### Author: ![mattyoung](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mattyoung/32/170562_2.png) [@mattyoung](https://meta.discourse.org/u/mattyoung)
#### Post date: [February 16, 2023, 7:33pm UTC](https://meta.discourse.org/t/matomo-analytics/33090/86 "2023-02-16T19:33:48Z")

</div>

This should REALLY be added to the main instructions as it seems like a requirement UNLESS one were running Matomo on the same server as Discourse which I would think would be very rare.

Also in my case my Matomo is on another server maintained by another group and I’ve got a URL for it like [https://subdomain.domain.com/subfolder/piwik.js](https://subdomain.domain.com/subfolder/piwik.js) and in this case it’s not super clear to me what domain pattern I should use in content\_security\_policy\_script\_src so I for the moment am just listing out multiple domains in that setting line by line which I don’t feel great about like:

[https://subdomain.domain.com](https://subdomain.domain.com)  
[https://subdomain.domain.com/](https://subdomain.domain.com/)  
[https://subdomain.domain.com/subfolder](https://subdomain.domain.com/subfolder)  
[https://subdomain.domain.com/subfolder/](https://subdomain.domain.com/subfolder/)  
[https://subdomain.domain.com/subfolder/piwik.js](https://subdomain.domain.com/subfolder/piwik.js)  
[https://subdomain.domain.com/subfolder/piwik.php](https://subdomain.domain.com/subfolder/piwik.php)

…and then it lets you specify an order with an Arrow option for sorting up and down… which is all great - who doesn’t like options… but in this case when trying to configure something to work probably clear concise direction is most valuable.

The only thing I AM confident of is I did indeed include https:// before my URL which I’m sure is good as the cert is good, so is the connection, you said it in your post and content\_security\_policy\_script\_src instructions denote it under it’s field as well…

Is anyone super confident to tell me what domain pattern I should really use based on the context I provided above? Thanks in advance.

---

<div class="post-metadata">

### Author: ![madrush](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/madrush/32/119502_2.png) [@madrush](https://meta.discourse.org/u/madrush)
#### Post date: [January 8, 2025, 10:08pm UTC](https://meta.discourse.org/t/matomo-analytics/33090/87 "2025-01-08T22:08:09Z")

</div>

When I try to add my Matomo host URL (`https://analytics.cosmos.coop`) to the content\_security\_policy\_script\_src field, I receive the following error:

> content\_security\_policy\_script\_src: Value must be either ‘unsafe-eval’ or ‘wasm-unsafe-eval’, or in the form ‘-’ where supported hash algorithms are sha256, sha384 or sha512. Ensure that your input is wrapped in single quotation marks.

Any idea what could be wrong here?

---

<div class="post-metadata">

### Author: ![NateDhaliwal](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/natedhaliwal/32/313494_2.png) [@NateDhaliwal](https://meta.discourse.org/u/NateDhaliwal)
#### Post date: [January 9, 2025, 9:29am UTC](https://meta.discourse.org/t/matomo-analytics/33090/88 "2025-01-09T09:29:32Z")

</div>

Did you wrap the URL in `'`?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [January 9, 2025, 9:43am UTC](https://meta.discourse.org/t/matomo-analytics/33090/89 "2025-01-09T09:43:47Z")

</div>

Discourse now uses a “Strict Dynamic” CSP, so adding individual URLs is no longer necessary (or possible). More info here:

> [@Content-Security-Policy now uses 'strict-dynamic'](https://meta.discourse.org/t/content-security-policy-now-uses-strict-dynamic/298172):
>
> From v3.3.0.beta1, Discourse implements a ‘strict-dynamic’ Content Security Policy (CSP). This will eliminate the need for manual CSP config, and will greatly improve compatibility with external tooling like tag-managers and advertising. As a site administrator, you don’t need to do anything. The change will take effect automatically, and any external scripts you’re using will keep working. No changes are required for themes. A small number of plugins [[1]](#footnote-1469066-1) may need a small tweak for compatibili…

I’ll remove that section from the OP here. Thanks for the heads-up @madrush

---

<div class="post-metadata">

### Author: ![madrush](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/madrush/32/119502_2.png) [@madrush](https://meta.discourse.org/u/madrush)
#### Post date: [January 9, 2025, 6:09pm UTC](https://meta.discourse.org/t/matomo-analytics/33090/90 "2025-01-09T18:09:25Z")

</div>

Thank you! I’ve got it working now.

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [January 13, 2025, 12:34pm UTC](https://meta.discourse.org/t/matomo-analytics/33090/91 "2025-01-13T12:34:26Z")

</div>

This theme component is working great. Thanks to the contributors!

Is anybody using Goals or other advanced features of Matomo?

Ideas for improvement:

- User groups (including custom groups) could be tracked through Matomo Custom Variables.

- Allow to send custom Events from Discourse to Matomo. That would be useful for connecting to Goals.

[Previous page](https://meta.discourse.org/t/matomo-analytics/33090.md?page=2)
