Konsta
Konsta

Reputation: 85

How do i set correct filters to request Google Analtyics data

Im using google analytics api java lib
What is correct format for filters?
For example i need to set

  1. ga:adContent != (not set)
  2. ga:keyword != (not provided)

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

Should be equal:

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

or

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

or just

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

Upvotes: 0

Views: 655

Answers (1)

Arnout Cator
Arnout Cator

Reputation: 81

I have this working for me:

` 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/");` 

where is the web address without http:// of my client

Upvotes: 1

Related Questions