Skip to content

Commit c5219a1

Browse files
committed
docs(router): add section about page title customization
1 parent 96058d1 commit c5219a1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,24 @@ successful Angular Router navigation event. Under the hood, it calls tracker met
7272
By default, page title is grabbed from DOM document title and page url is built from Router url. This is fully
7373
customizable as described in following subsections.
7474

75+
#### Customize page title
76+
77+
By default, Matomo's router tracks page view _right after_ `NavigationEnd` event is emitted by Angular router and
78+
retrieves title from Angular `Title` service. Delay is configurable with the `delay`
79+
[configuration property](docs/configuration-reference.md#ngxmatomoroutermodule).
80+
81+
As of Angular 14, and as long as you don't set `delay` to `-1`, customizing page title by setting `title` property of
82+
Angular route config is natively supported. See Angular tutorial
83+
here: [Setting the page title](https://angular.io/guide/router#setting-the-page-title).
84+
85+
If you still need more customization, you can define a `MatomoRouterInterceptor`
86+
calling `MatomoTracker.setDocumentTitle()` as detailed in
87+
the [dedicated section below](#customize-anything-page-title-ecommerce-view).
88+
7589
#### Customize page url
7690

77-
You may provide a custom service to return current page url:
91+
By default, the _current_ url will be sent to Matomo. You may provide a service
92+
to return a custom page url:
7893

7994
```typescript
8095
import { PageUrlProvider, MATOMO_PAGE_URL_PROVIDER } from '@ngx-matomo/router';

0 commit comments

Comments
 (0)