请求检索FullvisitorId的列表-BigQuery

时间:2019-07-18 12:27:41

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

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

standardSQL

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'

1 个答案:

答案 0 :(得分:0)

您只需运行以下命令即可获取不同的public class Pizza { private Map<String, List<String>> ingredients = new HashMap(); public Map<String, List<String>> getIngredients() { return ingredients; } public void addIngredient(String name, List<String> values) { ingredients.put(name, values); } public static void main(String[] args) { Pizza pizza = new Pizza(); pizza.addIngredient("main", Arrays.asList("flour", "water", "egg")); pizza.addIngredient("optional", Arrays.asList("olives", "salami")); ObjectMapper mapper = new ObjectMapper(); System.out.println(mapper.writeValueAsString(pizza)); } } 列表:

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