angular / angular/angularfire

screen_view is not triggered if multiple router-outlets

Open
#3,168 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.8k
Forks
2.2k
Avg merge
22h 28m
Merged PRs (30d)
6

Description

I'm using ion-split-pane in my project to follow master-detail pattern, in which you place two router-outlets on your app.component.html and then you can navigate separately on each side of the view. An example of this pattern is here: https://ionic-angular-v5-cduaar.stackblitz.io

I have ScreenTrackingService in providers of the app.module. When I navigate in the main router-outlet, "screen-view" and "page-view" events are fired.

```
Processing data layer push: {event: "gtm.historyChange-v2", gtm.oldUrl: "http://localhost:4200/master-1", gtm.newUrl:
"http://localhost:4200/master-2", gtm.triggers: "1_30"}

Processing GTAG command: ["event", "screen_view", { page_path: "/master-2", outlet: "primary" ...etc }]
```

When I navigate in the detail router-outlet, only "page-view" event is fired. There I can see that it has the correct url, but screen-view event is not fired.
```
Processing data layer push: {event: "gtm.historyChange-v2", gtm.oldUrl: "http://localhost:4200/detail-1", gtm.newUrl:
"http://localhost:4200/detail-2", gtm.triggers: "1_30"}
```
**Versions:**
Angular: 12.2.0
Ionic/angular: 5.7.0
firebase: 9.6.6
angular/fire: 7.2.1

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the master-detail navigation in the linked StackBlitz with ScreenTrackingService provided in app.module and two outlets in app.component.html. Compare primary and detail navigation and determine why only page-view is emitted; done means screen_view is emitted for detail-outlet navigation with the correct URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, firebase, typescript
Domain
analytics, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.