# Javascript in theme component only runs once?

**URL:** <https://meta.discourse.org/t/javascript-in-theme-component-only-runs-once/106202>\
**Category:** Product Support\
**Created:** [January 10, 2019, 3:52pm UTC](https://meta.discourse.org/t/javascript-in-theme-component-only-runs-once/106202 "2019-01-10T15:52:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [January 10, 2019, 4:11pm UTC](https://meta.discourse.org/t/javascript-in-theme-component-only-runs-once/106202/2 "2019-01-10T16:11:39Z")

</div>

Use the page tracker API to call the necessary function on page change. Here an example:

[https://github.com/discourse/discourse-matomo-analytics/blob/master/common/head\_tag.html](https://github.com/discourse/discourse-matomo-analytics/blob/master/common/head_tag.html)

---

_[View the full topic](https://meta.discourse.org/t/javascript-in-theme-component-only-runs-once/106202)._
