简体   繁体   English

无法从 Google Measurement Protocol (Google Analytics v4) 接收事件

[英]Cannot receive events from Google Measurement Protocol (Google Analytics v4)

I created an app in Firebase, and then found my target app (NodeJS CLI, Chrome extension, VSCode extension) could not use Firebase SDK, then I found the Google Measurement Protocol.我在Firebase创建了一个app,然后发现我的目标app(NodeJS CLI,Chrome扩展,VSCode扩展)无法使用 Firebase SDK,然后我找到了Google Measurement Protocol。 And it turns out to be frustrating and failed to get events to show up in the console.事实证明这很令人沮丧,无法让事件显示在控制台中。

My request passed /debug/mp.collect :我的请求通过了/debug/mp.collect

fetch(
    `https://www.google-analytics.com/mp/collect?api_secret=${SECRET}&firebase_app_id=${FIREBASE_APP_ID}`,
    {
      method: 'POST',
      body: JSON.stringify({
        app_instance_id: ${INSTANCE_ID},
        events,
      }),
    }
  )

1st problem I met is finding the api_secret我遇到的第一个问题是找到api_secret

Official doc says: 官方文档说:

An API SECRET generated in the Google Analytics UI.在 Google Analytics UI 中生成的 API SECRET。 To create a new secret, navigate to: Admin > Data Streams > choose your stream > Measurement Protocol > Create要创建新机密,请导航至:Admin > Data Streams > 选择您的 stream > Measurement Protocol > Create

What I get is:我得到的是: 在此处输入图像描述

OK then comes into firebase: OK然后进入firebase:

const firebaseConfig = {
  apiKey: "xxx",
  authDomain: "dev-ext.firebaseapp.com",
  databaseURL: "https://dev-ext.firebaseio.com",
  projectId: "test",
  storageBucket: "dev-ext.appspot.com",
  messagingSenderId: "123",
  appId: "xxx",
  measurementId: "xxx"
};

Looks like is this apiKey , and I tried, not working.看起来是这个apiKey ,我试过了,没有用。

Then I found someone says use the secret here:然后我发现有人说在这里使用秘密: 在此处输入图像描述

And I tried, not working.我试过了,没有用。

2nd problem is the app_instance_id , what the hell is this?第二个问题是app_instance_id ,这到底是什么?

Here is the original doc:这是原始文档:

在此处输入图像描述

No clues for web and NodeJS case at all, and the ios, android links are pointing to Firebase SDK method.根本没有 web 和 NodeJS 案例的线索,ios、android 链接指向 Firebase SDK 方法。 I was like "WTF, why will I read this if I could use the Firebase SDK?"我当时想“WTF,如果我可以使用 Firebase SDK,我为什么还要读这个?”

So I tried a generated uuid.所以我尝试了一个生成的uuid。 And obviously, it's not working.显然,它不起作用。

I have the same, issue.我有同样的问题。 Ended up adding a new stream on analytics.google.com and switching to gtag.js .最后在analytics.google.com上添加了一个新的 stream 并切换到gtag.js

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google Analytics API v4 最大结果 - Google analytics API v4 max results 谷歌分析报告 api v4 不显示 isDataGolden - google analytics reporting api v4 not show isDataGolden 通过google analytics v4 admin API 创建账户 - Create account through google analytics v4 admin API 在使用 Google Analytics 4 自动增强测量事件时报告 Data Studio 中的下载量为 URL? - Reporting URL of downloads in Data Studio when using Google Analytics 4 automatic enhanced measurement events? Python 云 Shell 测量协议 Google Analytic Universal - Python Cloud Shell Measurement Protocol Google Analytic Universal Flutter 应用计数 Google Analytics 事件两次 - Flutter App Counting Google Analytics Events TWICE Firebase 事件的 Google Analytics,因为 Google Ads 中的转化不适用于 Android - Google Analytics for Firebase events as conversions in Google Ads not working for Android Google Cloud Functions 和 Sheets v4 之间的并发问题 API - Concurrency Issues between Google Cloud Functions and Sheets v4 API 无论如何,是否可以在 Google Analytics 中查看我从 Firebase 应用程序记录的(自定义)事件? - Is there anyway to see the (custom) events that I logged from my Firebase app in Google Analytics? 在 Google Analytics(React 应用程序)中跟踪自定义事件 - Keeping track of custom events in Google Analytics (React app)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM