# Count page invocations

**URL:** https://discuss.emberjs.com/t/count-page-invocations/20398
**Category:** Uncategorized
**Created:** [January 23, 2024, 8:47am UTC](https://discuss.emberjs.com/t/count-page-invocations/20398 "2024-01-23T08:47:30Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Marco\_Musolf](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/marco_musolf/32/17400_2.png) [@Marco\_Musolf](https://discuss.emberjs.com/u/Marco_Musolf)
#### Post date: [January 23, 2024, 8:47am UTC](https://discuss.emberjs.com/t/count-page-invocations/20398/1 "2024-01-23T08:47:31Z")

</div>

Hi, I want to count the invocation of page within an ember app which means every time the user navigates to a new page (via link-to) the system should increment a counter for this page. My problem is that I have no idea on how to implement this behaviour. Any helpis appreciated 🙂

---

<div class="post-metadata">

### Author: ![kennstenicht](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/kennstenicht/32/18221_2.png) [@kennstenicht](https://discuss.emberjs.com/u/kennstenicht)
#### Post date: [January 23, 2024, 10:23am UTC](https://discuss.emberjs.com/t/count-page-invocations/20398/2 "2024-01-23T10:23:12Z")

</div>

Hi Marco, the route service has a routeDidChange event. Maybe this helps.

```auto
// app/routes/application.js
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class ApplicationRoute extends Route {
  @service router;

  constructor() {
    super(...arguments);

    this.router.on('routeDidChange', () => {
      const page = this.router.currentURL;
      const title = this.router.currentRouteName
    });
  }
}

```

---

<div class="post-metadata">

### Author: ![Marco\_Musolf](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/marco_musolf/32/17400_2.png) [@Marco\_Musolf](https://discuss.emberjs.com/u/Marco_Musolf)
#### Post date: [January 23, 2024, 12:26pm UTC](https://discuss.emberjs.com/t/count-page-invocations/20398/3 "2024-01-23T12:26:01Z")

</div>

Hi Christoph, the Route class has a method “activate” which did the job. Your solution seems to be an alternative. Thx 🙂
