【问题标题】:Request to retrieve a list of FullvisitorId - BigQuery请求检索 FullvisitorId 列表 - BigQuery
【发布时间】:2023-03-12 04:55:02
【问题描述】:

我想获取 FullvisitorId 的列表。 但我不知道如何在我的请求中选择 FullvisitorId 列表.. 目标是特别检索 FullvisitorId 列表,而不是所有会话

标准SQL

SELECT  
        date,
        visitStartTime,
        TIMESTAMP_SECONDS(visitStartTime) as starttime_UTC,
        DATETIME(TIMESTAMP_SECONDS(visitStartTime), "Europe/Amsterdam") as starttime_LOCAL,
        totals.timeOnSite,

        
        trafficSource.source,
        trafficSource.referralPath,
        hits.hour,
        hits.minute,
        hits.hitNumber,
        fullVisitorId,
        hits.isEntrance,
        hits.isExit,
        hits.referer,
        hits.eventInfo.eventAction,
        hits.latencyTracking.userTimingValue,
        hits.type,
   
   CONCAT(CAST(fullvisitorid AS string),CAST(visitid AS string)) AS case_id,
         CONCAT(CAST( EXTRACT(YEAR FROM PARSE_DATE('%Y%m%d',date) )  AS string) ,"/", 
   CAST( EXTRACT(MONTH FROM PARSE_DATE('%Y%m%d',date))AS string) , "/" , 
   CAST( EXTRACT(DAY FROM PARSE_DATE('%Y%m%d',date) )  AS string), " " ,
   CAST(hits.hour AS string), ":" ,
   CAST(hits.minute AS string), ":" ,
   CAST(hits.hitNumber AS string)) AS dated,
   
        (SELECT MAX( IF(index = 4,value,NULL) )  FROM UNNEST(hits.customDimensions)) type_page,
       
        (SELECT MAX( IF(index = 6,value,NULL) )  FROM UNNEST(hits.customDimensions)) Univers 
        
        
          FROM `ga-orange-pro-etp.*****.ga_sessions_20190616*` , UNNEST(hits) as hits 
        WHERE (SELECT MAX( IF(index =   10,value,NULL) )  FROM UNNEST(hits.customDimensions)) = 'prod'

【问题讨论】:

    标签: mysql google-bigquery bigquery-standard-sql google-analytics-filters


    【解决方案1】:

    您可以通过运行简单地获取不同 fullVisitorId 的列表:

    SELECT
      DISTINCT fullVisitorId
    FROM `ga-orange-pro-etp.*****.ga_sessions_20190616*` , UNNEST(hits) as hits 
    WHERE (SELECT MAX( IF(index =   10,value,NULL) )  FROM UNNEST(hits.customDimensions)) = 'prod'
    

    如果您删除 DISTINCT,它将为每行返回一个值,因此您将看到重复的 fullVisitorId

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-17
      • 1970-01-01
      • 1970-01-01
      • 2018-01-09
      • 1970-01-01
      • 1970-01-01
      • 2015-03-04
      相关资源
      最近更新 更多