angular / angular/angularfire

Analytics: When using ScreenTrackingService the average engagement time is calculated the wrong way

未關閉
#3,214 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
TypeScript
星號
7.8k
分支
2.2k
平均合併
22 小時 28 分鐘
30 天內合併 PR
6

描述

### Version info

**Angular:**
"@angular/animations": "13.1.3",
"@angular/common": "13.1.3",
"@angular/compiler": "13.1.3",
"@angular/core": "13.1.3",
"@angular/forms": "13.1.3",
"@angular/platform-browser": "13.1.3",
"@angular/platform-browser-dynamic": "13.1.3",
"@angular/router": "13.1.3",
"rxjs": "7.4.0",
"tslib": "2.3.1",
"zone.js": "0.11.4",
"typescript": "4.5.5"

**Firebase:**
"firebase": "9.6.7",

**AngularFire:**
"@angular/fire": "7.2.1",

**System:**
NodeJS: v12.20.2
npm: 6.14.11
OS: macOS Monterey (12.2.1)

### How to reproduce these conditions

[Demo example](https://github.com/timkos/test-analytics) (fix firebase config in AppModule)

**Steps to set up and reproduce**
1. provide FirebaseApp and Analytics and add ScreenTrackingService to AppModule:
```
imports: [
BrowserModule,
AppRoutingModule,
provideFirebaseApp(() =>
initializeApp(config)
),
provideAnalytics(() => getAnalytics())
],
providers: [ScreenTrackingService] ```
2. Create two routes `/test` and `/test2`. The route `/test` we will visit and stay on it for a longer time. On the other hand, we will always go to `/test2` just for a short time and then always go back to `/test` route.

**Sample data and security rules**

### Debug output
After some time we can see Average Engagement Times for visited paths (screens) on

Firebase -> Analytics -> Dashboard -> View pages and screens.

To see data for screen names (routes) switch from 'Page title and screen class' to 'Page title and screen name'.

![Screenshot 2022-04-26 at 10 38 58](https://user-images.githubusercontent.com/11668087/165262670-2b051bc9-647c-49a1-b2be-1385a1a8eb97.png)

### Expected behavior
Average Engagement Time of the route `/test` should be much bigger then the one of the `/test2` route.

### Actual behavior
Average Engagement Time of the route `/test` is much smaller then the one of `/test2` route.

It looks like previous engagement time is added to the next visited route (screen). It should be added to the previous route (screen).

貢獻指南

開啟貢獻指南

研究方向

從 AppModule 中的 ScreenTrackingService 註冊開始,依照連結示範中的描述造訪 /test 和 /test2,重現路由序列。將 Firebase Analytics 的畫面互動結果與預期的路由歸因進行比較;當存續時間較長的 /test 路由回報的平均互動時間顯著高於 /test2 時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
angular, firebase, typescript
領域
analytics, frontend
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。