如何设置正确的过滤器以请求Google Analtyics数据

时间:2016-10-17 11:13:36

标签: java google-analytics-api google-api-java-client google-analytics-filters

我正在使用谷歌分析api java lib
过滤器的格式是什么?
例如,我需要设置

  1. ga:adContent!=(未设置)
  2. ga:keyword!=(未提供)

    Analytics.Data.Ga.Get statRequest = requestParams.getAnalytics().data().ga().get(  
                        "ga:" + request.getProfile().getId(),  
                        request.getStartDate(),  
                        request.getEndDate(),  
                        request.getMetrics())  
                        .setFilters(filters)  
    String filters;  
    
  3. 应该是平等的:

    "ga:adContent!=(not%20set);ga:keyword!=(not%20provided)" 
    

    "ga%3AadContent!%3D(not%20set)%3Bga%3Akeyword!%3D(not%20provided)" 
    

    或只是

    "ga:adContent!=(not set);ga:keyword!=(not provided)"   
    

1 个答案:

答案 0 :(得分:1)

我有这个为我工作:

` ReportRequest request = new ReportRequest()
    .setViewId(VIEW_ID)
    .setDateRanges(Arrays.asList(dateRange))
    .setDimensions(Arrays.asList(pagePath))
    .setMetrics(Arrays.asList(pageviews));

  request.setFiltersExpression("ga:pagePath!=\"<myclientURL>/maths/undergraduate/courses/g100_mathematics.page\";ga:pagePath=@/undergraduate/courses/");` 

我的客户

的http://的网址在哪里