ga_aw_filter_expr: Create a filter expression for use with App+Web Reports

Description Usage Arguments Details Value Examples

View source: R/app_web_functions.R

Description

For use with google_analytics_aw - filter expressions are built up via filters or other nested filter expressions.

Usage

1
ga_aw_filter_expr(..., type = c("default", "not", "and", "or"))

Arguments

...

Vectors of ga_aw_filter, or vectors of FilterExpression created from previous calls to this function.

type

The type of filter

Details

The fields in a FilterExpression need to be either all dimensions or all metrics. Use them in the appropriate dimensionFilter or metricFilter arguments within google_analytics_aw

You can't pass a mix of filters and filter expressions, or multiple filter expressions with type="not" as it doesn't know how to combine the filters (and/or) - make a filter expression with type = "and/or" then pass that back into the function with type="not" to negate the filter expression.

Value

A FilterExpression

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
simple <- ga_aw_filter_expr(ga_aw_filter("city", "Copenhagen", "EXACT"))

multiple <- ga_aw_filter_expr(
      ga_aw_filter("dayOfWeek", "4", "EXACT"),
     ga_aw_filter("dayOfWeek", "5", "EXACT"),
    type = "or")
   
# equivalent to above as uses InList filter
multiple_or2 <- ga_aw_filter_expr(
      ga_aw_filter("dayOfWeek", c("4","5")))

# make a filter expression then pass it again with type='not' to negate it 
negative <- ga_aw_filter_expr(multiple_or2, type = "not")

# or directly - 
clean_city <- ga_aw_filter_expr(
  ga_aw_filter("city", "(not set)", "EXACT",), type = "not")

# use previously created FilterExpressions to build up more complex filters
complex <- ga_aw_filter_expr(multiple_or2, clean_city)

   

MarkEdmondson1234/googleAnalyticsR_public documentation built on Nov. 21, 2020, 4:40 a.m.