Google Analytics 4 API – pagePathPlusQueryString

huangapple go评论66阅读模式
英文:

Google Analytics 4 API - pagePathPlusQueryString

问题

以下是已翻译的内容:

我想使用Google Analytics 4 API(POST https://analyticsdata.googleapis.com/v1beta/properties/GA4_PROPERTY_ID:runReport)获取pagePathPlusQueryString、sessionCampaignName和totalUsers的数据。

当我将sessionCampaignName添加到维度中时,它会给我带来不兼容性错误。

维度:日期、pagePathPlusQueryString和sessionCampaignName

"dimensions": [
{
"name": "date"
},
{
"name": "pagePathPlusQueryString"
},
{
"name": "sessionCampaignName"
}
]

度量:totalUsers和screenPageViews

"metrics": [
{
"name": "totalUsers"
},
{
"name": "screenPageViews"
}
]

是否有办法可以获取带有querystring和sessionCampaignName的数据?

如果您有任何建议,请告诉我。谢谢。

关于pagePathPlusQueryString和sessionCampaignName的不兼容性问题。

英文:

I would like to pull the data for pagePathPlusQueryString , sessionCampaignName & totalUsers using google analytics 4 API ( POST https://analyticsdata.googleapis.com/v1beta/properties/GA4_PROPERTY_ID:runReport).

It is giving me the incompatibility error when I add sessionCampaignName to the dimensions.

Dimensions: date, pagePathPlusQueryString & sessionCampaignName

"dimensions": [
 {
  "name": "date"
},
 {
  "name": "pagePathPlusQueryString"
},
{
  "name": "sessionCampaignName"
}
 ]

Metrics: totalUsers & screenPageViews

"metrics": [
{
  "name": "totalUsers"
},
{
  "name": "screenPageViews"
}

]

Is there any way that we can get the data with querystring & sessionCampaignName ?

Please let me know if you have any suggestions.. Thanks.

Incompatibility issues with pagePathPlusQueryString & sessionCampaignName

答案1

得分: 1

我们几天前遇到了同样的问题。

从GA4文档中找到了以下信息:

包括查询字符串的维度,比如pagePathPlusQueryString,只能与有限的一组维度和指标兼容。

https://developers.google.com/analytics/devguides/reporting/data/v1/announcements/20221201-compatibility-changes#metrics_compatible_with_query_string_dimensions

所以,如果将查询字符串放入事件参数中,那么应该可以工作。

似乎pagePathPlusQueryString仍然像页面级维度一样,与常规事件参数不同。

关于如何从GA4数据API获取自定义事件参数的信息:

https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#custom_dimensions

当你有自定义事件参数、维度或指标时,你可以像这样替换维度和指标:

customEvent:{parameter_name}

然后它应该像标准参数一样工作。

英文:

We running into same issue a few days ago.

Found these information from GA4 document


Dimensions that include the query string like pagePathPlusQueryString will only be compatible with a limited set of dimensions & metrics.

https://developers.google.com/analytics/devguides/reporting/data/v1/announcements/20221201-compatibility-changes#metrics_compatible_with_query_string_dimensions


So we get the queryString into event parameter then it should work.

Seems like the pagePathPlusQueryString is still like page level dimension and different from regular event parameter.


About How to get the custom event parameter from GA4 Data API

https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema#custom_dimensions

When you have custom event parameter, dimensions or metrics. You can just replace the dimensions and metrics like

customEvent:{parameter_name}

Then it should work like standard parameters.

huangapple
  • 本文由 发表于 2023年6月13日 01:51:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/76459152.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定