[英]How do I get View ID from Google Analytics 4?
I tried to retrieve all information about my website from GA (Google Analytics).我试图从 GA (Google Analytics) 检索有关我网站的所有信息。 I'm using laravel and this package https://github.com/spatie/laravel-analytics to make my life easier.我正在使用 laravel 和这个 package https://github.com/spatie/laravel-analytics让我的生活更轻松。 However, that package requires "View ID" from GA, which I can't help myself to find it.然而,那个 package 需要 GA 的“查看 ID”,我无法帮助自己找到它。 I read this thread https://support.google.com/analytics/thread/15684521?hl=en and I'm guessing that since GA 4 they totally removed the views column from Web + App property (which will be created as a default) (correct me pls).我读了这个线程https://support.google.com/analytics/thread/15684521?hl=en我猜从 GA 4 开始,他们完全从 Web + App 属性(将创建为默认)(请纠正我)。 Did anyone had this problem before?以前有人遇到过这个问题吗? Where I can find that "view id"?在哪里可以找到“视图 ID”? are there some articles that can help me solve this problem?有一些文章可以帮助我解决这个问题吗? Any suggestion about better way to achieve my goal?关于实现我的目标的更好方法的任何建议?
In GA4 there aren't Views so you if you want to use your code (who needs a View), you have to create a Universal Analytics Property.在 GA4 中没有视图,因此如果您想使用您的代码(需要视图),您必须创建一个 Universal Analytics Property。
You can find it by clicking on Show advanced options
(when you create a new property):您可以通过单击Show advanced options
找到它(当您创建新属性时):
For anyone using GA4, you must use Google Analytics Data API instead of Reporting API. Use the same oauth scopes and you can use already issued token.对于任何使用 GA4 的人,您必须使用Google Analytics Data API而不是 Reporting API。使用相同的 oauth 范围,您可以使用已经发布的令牌。 This is the sample http request (post):这是示例 http 请求(发布):
https://analyticsdata.googleapis.com/v1beta/properties/[property id]:runRealtimeReport
with example body:示例正文:
{
"metrics": [{ "name": "activeUsers" }]
}
which gives you simple result.这给你简单的结果。 Keep in mind that metrics are different, there are now no totalUsers.请记住,指标是不同的,现在没有 totalUsers。 Use this list which has all allowed metrics and you can find dimensions on the same page.使用此包含所有允许指标的列表,您可以在同一页面上找到维度。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.