Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Events in Analytics are missing In the dashboard /Big query

未关闭
#3,470 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
angular, firebase, typescript

调研方向

从 Angular 组件订阅和 AnalyticsService.customlogEvent 入手,然后检查对 AngularFireAnalytics.logEvent 和 setUserProperties 的调用。重现报告的事件缺失问题,并将调试器输出与导出到 BigQuery 的事件进行比较;确定事件缺失的原因以及任何受支持的可靠性限制后,即视为完成。

由索引模型根据 Issue 内容生成。

描述

Version info
Angular: 14

Firebase: 9.X.X

AngularFire: 7.4.1

Other (e.g. Ionic/Cordova, Node, browser, operating system): chrome, phones, Edge, safari

How to reproduce these conditions: trying to upload app

Steps to set up and reproduce: X

Sample data and security rules: X

Debug output
** In the debugger, I also notice the term 'undefined.' I'm not sure if this is related. Here's a snippet of what I see in the debugger:

js?l=dataLayer&id=G-XXXX:296 Sending event "event_name" to undefined
js?l=dataLayer&id=G-XXXX:296 Request parameters:
js?l=dataLayer&id=G-XXXX:296 en: event_name
js?l=dataLayer&id=G-XXXX:296 ep.origin: firebase
js?l=dataLayer&id=G-XXXX:296 ep.some_id: 12123124
js?l=dataLayer&id=G-XXXXX:296 ep.some_name: Name 123 Name

js?l=dataLayer&id=G-XXXX:296 Sending request: https://www.google-analytics.com/g/collect?v=2&tid=G-.......

**

** Output from firebase.database().enableLogging(true); ** X

** Screenshots ** - X

Expected behavior

I have an Angular application integrated with Firebase, and the data is exported to BigQuery.

In my Angular app, there is a requirement to send an event to analytics upon loading. However, I've noticed that only 80-90% of other events(in other application) are being tracked, even for the same user and the same device/platform, and there are no ad blockers in use.

I have attempted to use async/await to ensure that the event is sent reliably. Is this approach appropriate? Does the code appear to be correct? Is there a way to ensure that the event will always be sent?

Could it be beneficial to send another event elsewhere? Is there a potential issue with the data itself?

Is there something that can be improved in the analytics configuration itself?

When using the Analytics Debugger Chrome extension, I can see the events, but testing with external users is challenging.

My goal is to get 100%of the events

Actual behavior

component

   this.test$ = this.data$.pipe(map((data) => data.test));
   this.test$.subscribe(async (test) => {
      const analyticsEvent: AnalyticsEventData = {
        some_id: string,
        some_id2: string
        some_name: string,
        some_id: string,
        some_date: firebase-timestampObject.toMillis(),
        app_name: 'string',
      };

      this.analyticsService.data = analyticsEvent;

      await this.analyticsService.custonlogEvent('event_name');
      await this.analyticsService.setUserProperties(analyticsEvent);

    });

any my analytics service

import { Injectable } from '@angular/core';
import { AngularFireAnalytics } from '@angular/fire/compat/analytics';

@Injectable({
  providedIn: 'root',
})
export class AnalyticsService {
  constructor(private analytics: AngularFireAnalytics) {}
  private _data:AnalyticsEventData;

  get data() {
    return this._data;
  }
  set data(value) {
    this._data = value;
  }

  async customlogEvent(eventName: string, params?: { [key: string]: any }) {
    try {
      if (!this._data) throw new Error('error');

      const generalParameters = this._data;

      const paramsObject = {
        ...generalParameters,
        ...params,
      };
      await this.analytics.logEvent(eventName, paramsObject);
    } catch (e) {
      console.log(e);
    }

    return true;
  }

  async setUserProperties(params: { [key: string]: any }) {
    return await this.analytics.setUserProperties(params);
  }
}
主要语言
TypeScript
星标
7.8k
派生
2.2k
平均合并
3 天 6 小时
30 天内合并 PR
5

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

angular/angularfire 的其他 Issue

查看 angular/angularfire 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。