gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 06:56:33 25 4
gpt4 key购买 nike

我在 Firebase 中创建了一个应用程序,然后发现我的目标应用程序(NodeJS CLI、Chrome 扩展、VSCode 扩展)无法使用 Firebase SDK,然后我找到了 Google Measurement Protocol。结果令人沮丧,未能让事件显示在控制台中。

我的请求通过了/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,
}),
}
)

第一个问题 我遇到的是找到api_secret

Official doc说:

An API SECRET generated in the Google Analytics UI. To create a new secret, navigate to:Admin > Data Streams > choose your stream > Measurement Protocol > Create

我得到的是: enter image description here

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"
};

看起来是这个apiKey,我试过了,没用。

然后我发现有人说在这里使用 secret : enter image description here

我试过了,没用。

第二个问题是app_instance_id,这是什么鬼?

这是原始文档:

enter image description here

根本没有关于 web 和 NodeJS 案例的线索,而 ios、android 链接都指向 Firebase SDK 方法。我当时想“WTF,如果我可以使用 Firebase SDK,我为什么还要读这个?”

所以我尝试了一个生成的uuid。显然,它不起作用。

最佳答案

我也有同样的问题。最终在 analytics.google.com 上添加了一个新流并切换到 gtag.js

关于google-analytics - 无法从 Google Measurement Protocol (Google Analytics v4) 接收事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65101971/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com