【问题标题】:Export google CrUX data导出谷歌 CrUX 数据
【发布时间】:2021-05-26 16:55:48
【问题描述】:

我正在尝试将CrUX data 的一个子集移动到.csv 文件,以便使用谷歌搜索控制台上没有的工具进行分析。

我尝试将一个或多个 .csv 文件从这样的查询导出到谷歌云存储桶(或任何其他地方):

SELECT
fcp
FROM
`chrome-ux-report.all.201809`,
UNNEST(first_contentful_paint.histogram.bin) AS fcp
WHERE origin = 'https://developers.google.com'

我尝试了两种不同的方法:

A.将查询结果导出到 .csv

this approach 之后,我得到了这样的结果:

EXPORT DATA OPTIONS(
uri='gs://nha-1234.appspot.com/crux/201809*.csv',
format='CSV',
overwrite=true,
header=true,
field_delimiter=';') AS
SELECT
origin, fcp_start, fcp_density, fcp_end
FROM
`chrome-ux-report.all.201809`,
first_contentful_paint.histogram.bin.start AS fcp_start,
first_contentful_paint.histogram.bin.density AS fcp_density
first_contentful_paint.histogram.bin.end AS fcp_end
WHERE
origin = 'https://developers.google.com'

我遇到了这样的错误:

项目 ID“first_contentful_paint.histogram”无效。项目 ID 必须包含 6-63 个小写字母、数字或短划线。一些项目 ID 还包括以冒号分隔的域名。 ID 必须以字母开头,不能以破折号结尾。

我认为 CrUX 项目无法识别。

B.将数据的子集导出到汇总表

根据the documentation for exporting data.csv 可能无法直接导出。所以想法是用CrUX数据的一个子集创建一个更小的表,然后在后续步骤中使用上面的(A)将它导出到.csv

我似乎也在这里碰壁了,可能是因为 CrUX 数据集是not listed as one of the public data sets

这似乎仍然可行,但我似乎无法完成这项工作 - 如果使用其中一个 SDK,我应该使用哪个 projectId/datasetName/tableName?

【问题讨论】:

    标签: java csv google-cloud-platform google-bigquery


    【解决方案1】:

    可以进行大查询以从给定报告中获取数据:

      SELECT
      origin,
      `chrome-ux-report`.experimental.PERCENTILE(ARRAY_AGG(fcp), 75) AS p75_fcp,
      `chrome-ux-report`.experimental.PERCENTILE(ARRAY_AGG(fid), 75) AS p75_fid,
      `chrome-ux-report`.experimental.PERCENTILE(ARRAY_AGG(lcp), 75) AS p75_lcp
    FROM
      `chrome-ux-report.all.202109`,
      UNNEST(first_contentful_paint.histogram.bin) AS fcp,
      UNNEST(largest_contentful_paint.histogram.bin) AS lcp,
      UNNEST(first_input.delay.histogram.bin) AS fid,
      UNNEST(layout_instability.cumulative_layout_shift.histogram.bin) AS cls
    WHERE
      origin in (
        'https://www.example.com'
      )
    group by origin
    

    【讨论】:

      猜你喜欢
      • 2018-11-15
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-29
      • 1970-01-01
      相关资源
      最近更新 更多