# Matomo 分析在最近更新后无法正常工作

**URL:** https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152
**Category:** Support
**Created:** [2018年十月22日 09:24 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152 "2018-10-22T09:24:55Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [2018年十月22日 09:24 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/1 "2018-10-22T09:24:55Z")

</div>

2 days ago, I updated my discourse. However, after that, my Matomo analytics for discourse doesn’t log any visit at all. The code for Matomo is still in my discourse in the right place, and I didn’t change it at all.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年十月22日 22:45 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/2 "2018-10-22T22:45:04Z")

</div>

What is the actual code you are using?

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [2018年十月22日 22:47 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/3 "2018-10-22T22:47:15Z")

</div>

It is exactly what matomo gives me to use.

```plaintext

<!-- Matomo -->
<script type="text/javascript">
 var _paq = _paq || [];
 /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
 _paq.push(['trackPageView']);
 _paq.push(['enableLinkTracking']);
 (function() {
   var u="//zabanshenas.com/piwik/";
   _paq.push(['setTrackerUrl', u+'piwik.php']);
   _paq.push(['setSiteId', '2']);
   var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
   g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
 })();
</script>
<!-- End Matomo Code -->

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年十月22日 22:49 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/4 "2018-10-22T22:49:57Z")

</div>

Did you follow ALL the instructions here?

> [@Matomo Analytics](https://meta.discourse.org/t/how-to-enable-matomo-analytics-on-discourse/33090):
>
> discourse2Summary Matomo Analytics is a script to enable Matomo analytics on Discourse.hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-matomo-analytics](https://github.com/discourse/discourse-matomo-analytics)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component Features [Matomo](https://matomo.org/) is an open source analytics platform. Users can choose between self-hosting or paying for professional hosting in the cloud. mega Matomo was formerly named Piwik. S…

Can you add a space to each of the scripts and save, it will re-trigger building internal caches.

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [2018年十月22日 22:56 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/5 "2018-10-22T22:56:21Z")

</div>

yes, I followed that instruction.

> [@sam](#):
>
> Can you add a space to each of the scripts and save

What scripts? I added a space in matomo script now. But it didn’t change anything.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年十月22日 22:58 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/6 "2018-10-22T22:58:26Z")

</div>

It is not meant to change anything, just trigger a cache rebuild, is it working now? Are there any errors in the Discourse console?

@Johani can we theme-componentize the motomo howto… not high priority but going to add to your list.

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [2018年十月22日 23:03 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/7 "2018-10-22T23:03:03Z")

</div>

> [@sam](#):
>
> is it working now?

No

> [@sam](#):
>
> Are there any errors in the Discourse console?

If you mean in web console, yes there is an error:

```plaintext
_paq is not defined
@https://talk.zabanshenas.com/theme-javascripts/82e69cdd6bb252c18196db6bbda6863824daa213.js?__ws=talk.zabanshenas.com:5:1
value/<@https://talk.zabanshenas.com/assets/application-5aac05c89f92b6b70efa2541a2fa250a5ae09077adc80108caa7e1f30013078a.js:12:24463
f@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:11:31855
trigger@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:15:15187
i/</<@https://talk.zabanshenas.com/assets/application-5aac05c89f92b6b70efa2541a2fa250a5ae09077adc80108caa7e1f30013078a.js:12:19521
e@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:23077
invokeWithOnError@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:19387
flush@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:19832
flush@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:20592
end@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:20937
run@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:22006
_runExpiredTimers@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:25751
p/this._boundRunExpiredTimers@https://talk.zabanshenas.com/assets/ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:7:17981
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:29446:6
u
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:29446:6
o
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:29425:6
e
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:13125:10
invokeWithOnError
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:12554:8
flush
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:12613:8
flush
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:12737:8
end
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:12807:6
run
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:12921:10
_runExpiredTimers
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:13315:4
p/this._boundRunExpiredTimers
_ember_jquery-27e777857b8c0730dacfe09cb11711365d21a5db4f9ee0b85d494e4259cf6cda.js:12776:4
DEBUG: For more advanced debugging, install the Ember Inspector from https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年十月22日 23:04 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/8 "2018-10-22T23:04:58Z")

</div>

Hmmm this could be an ordering thing, going to re-assign this to @xrav3nz

Kyle can you turn the [motomo howto](https://meta.discourse.org/t/how-to-enable-matomo-analytics-on-discourse/33090) into a working theme component with settings first thing tomorrow.

Going to bump this in front of the queue in case there is an ordering issue in place due to CSP related changes.

@hosna you are going to have to wait a day here…

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [2018年十月22日 23:06 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/10 "2018-10-22T23:06:26Z")

</div>

> [@sam](#):
>
> @hosna you are going to have to wait a day here…

No problem

Another thing, I have thousands of `Job exception: 404 Error: 404 Not Found` in my logs. Is it related to this?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年十月22日 23:06 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/11 "2018-10-22T23:06:51Z")

</div>

That sounds very unrelated to this issue

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [2018年十月22日 23:08 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/12 "2018-10-22T23:08:51Z")

</div>

This is the backtrace:

```plaintext
/var/www/discourse/lib/file_helper.rb:51:in `block in download' /var/www/discourse/lib/final_destination.rb:373:in `block (3 levels) in safe_get' /var/www/discourse/lib/final_destination.rb:372:in `catch' /var/www/discourse/lib/final_destination.rb:372:in `block (2 levels) in safe_get' /usr/local/lib/ruby/2.5.0/net/http.rb:1503:in `block in transport_request' /usr/local/lib/ruby/2.5.0/net/http/response.rb:165:in `reading_body' /usr/local/lib/ruby/2.5.0/net/http.rb:1502:in `transport_request' /usr/local/lib/ruby/2.5.0/net/http.rb:1464:in `request' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/net_patches.rb:9:in `block in request_with_mini_profiler' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/mini_profiler/profiling_methods.rb:39:in `step' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rack-mini-profiler-1.0.0/lib/patches/net_patches.rb:8:in `request_with_mini_profiler' /var/www/discourse/lib/final_destination.rb:344:in `block in safe_get' /var/www/discourse/lib/final_destination.rb:388:in `block in safe_session' /usr/local/lib/ruby/2.5.0/net/http.rb:910:in `start' /usr/local/lib/ruby/2.5.0/net/http.rb:609:in `start' /var/www/discourse/lib/final_destination.rb:385:in `safe_session' /var/www/discourse/lib/final_destination.rb:336:in `safe_get' /var/www/discourse/lib/final_destination.rb:108:in `get' /var/www/discourse/lib/file_helper.rb:43:in `download' /var/www/discourse/app/models/user_avatar.rb:23:in `block in update_gravatar!' /var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize' /var/www/discourse/lib/distributed_mutex.rb:5:in `synchronize' /var/www/discourse/app/models/user_avatar.rb:14:in `update_gravatar!' /var/www/discourse/app/jobs/regular/update_gravatar.rb:12:in `execute' /var/www/discourse/app/jobs/base.rb:137:in `block (2 levels) in perform' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rails_multisite-2.0.4/lib/rails_multisite/connection_management.rb:63:in `with_connection' /var/www/discourse/app/jobs/base.rb:127:in `block in perform' /var/www/discourse/app/jobs/base.rb:123:in `each' /var/www/discourse/app/jobs/base.rb:123:in `perform' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:187:in `execute_job' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:169:in `block (2 levels) in process' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/middleware/chain.rb:128:in `block in invoke' /var/www/discourse/lib/sidekiq/pausable.rb:81:in `call' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/middleware/chain.rb:130:in `block in invoke' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/middleware/chain.rb:133:in `invoke' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:168:in `block in process' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:139:in `block (6 levels) in dispatch' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/job_retry.rb:98:in `local' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:138:in `block (5 levels) in dispatch' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq.rb:36:in `block in &lt;module:Sidekiq&gt;' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:134:in `block (4 levels) in dispatch' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:199:in `stats' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:129:in `block (3 levels) in dispatch' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/job_logger.rb:8:in `call' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:128:in `block (2 levels) in dispatch' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/job_retry.rb:73:in `global' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:127:in `block in dispatch' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/logging.rb:48:in `with_context' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/logging.rb:42:in `with_job_hash_context' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:126:in `dispatch' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:167:in `process' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:85:in `process_one' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/processor.rb:73:in `run' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/util.rb:16:in `watchdog' /var/www/discourse/vendor/bundle/ruby/2.5.0/gems/sidekiq-5.1.3/lib/sidekiq/util.rb:25:in `block in safe_thread'

```

and this is the env:

```plaintext
|hostname|talk-app|
|---|---|
|process_id|[443, 452]|
|application_version|dca830cb73371faca8e8497af13064a5bc92b52d|
|current_db|default|
|current_hostname|talk.zabanshenas.com|
|job|Jobs::UpdateGravatar|
|problem_db|default|
|||
|opts||
|user_id|[131679, 131680, 131662, 131675, 131663, 131673, 131672, 131681, 131678, 131676, 131677, 131666, 131664, 131665, 131682, 131674, 131683, 131667, 131684, 131668, 131685, 131686, 131687, 131670, 131669, 131671, 131688, 131689, 131690, 131691, 131692, 131693, 131694, 131695, 131654, 131696, 131697, 131653, 131657, 131655, 131698, 131659, 131656, 131699, 131658, 131652, 131661, 131651, 131660, 131700]|
|avatar_id|[131214, 131215, 131197, 131210, 131198, 131208, 131207, 131216, 131213, 131211, 131212, 131201, 131199, 131200, 131217, 131209, 131218, 131202, 131219, 131203, 131220, 131221, 131222, 131205, 131204, 131206, 131223, 131224, 131225, 131226, 131227, 131228, 131229, 131230, 131189, 131231, 131232, 131188, 131192, 131190, 131233, 131194, 131191, 131234, 131193, 131187, 131196, 131186, 131195, 131235]|
|current_site_id|default|

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2018年十月22日 23:10 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/13 "2018-10-22T23:10:59Z")

</div>

Yeah we will start eating these errors soon, nothing to worry about.

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [2018年十月23日 14:52 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/14 "2018-10-23T14:52:03Z")

</div>

👋 @hosna, I’ve updated [Matomo Analytics](https://meta.discourse.org/t/how-to-enable-matomo-analytics-on-discourse/33090) to include instructions on how to install and setup the new “Matomo Analytics” theme component.

Could you give it a try? Please also remember to remove the original custom scripts.

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [2018年十月23日 17:02 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/15 "2018-10-23T17:02:37Z")

</div>

Thank you very much. Works like a charm.

---

<div class="post-metadata">

### Author: ![xrav3nz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xrav3nz/32/76894_2.png) [@xrav3nz](https://meta.discourse.org/u/xrav3nz)
#### Post date: [2018年十月24日 22:00 UTC](https://meta.discourse.org/t/matomo-analytics-is-not-working-after-recent-update/100152/18 "2018-10-24T22:00:06Z")

</div>

This topic was automatically closed after 21 hours. New replies are no longer allowed.
