This function creates the simple rule of a filter
filter_rule( dimension = NULL, metric = NULL, verb = NULL, object = NULL, description = NULL, is_distinct = FALSE, attribution = "repeating", attribution_context = "visitors", validate = FALSE, dataviewId = Sys.getenv("CJA_DATAVIEW_ID") )
This is the subject of the rule. The value should be the dimension id. Only the dimension or metric can be used at a time.
This is the subject of the rule. The value should be the metric id. Only the dimension or metric can be used at a time.
Choose from any of the 30 different verbs. Use the
package data to see all available verbs along with the descriptions.
This is the object of the rule and answers the question
The internal description for the rule. (optional) This will not show in the UI but could be very helpful when using the API.
This will filter on a distinct count of items within a dimension. Examples: “Visitors who viewed more than 5 distinct products,” or “Visits where more than 5 distinct pages were seen.”
Define the type of attribution. Either
nonrepeating. See Details for more information.
When applying a non-repeating instance attribution model
to a rule the context for the attribution must be
visitors (default) or
Set to TRUE when metric or dimension validation is preferred. Default is FALSE. Validation will slow down the function response time but ensure a valid rule result.
CJA data view id. Required if the argument
validate is set to TRUE.
If an environment variable called
CJA_DATAVIEW_ID exists in
elsewhere and no
dataviewId argument is provided, then the
CJA_DATAVIEW_ID value will
be used. Use
cja_get_dataviews() to get a list of available
A structured list defining the rule for a filter
Attribution Models Available for dimensions only, these models determine what values in a dimension to filter for. Dimension models are particularly useful in sequential filter.
repeating (default): Includes instances and persisted values for the dimension.
instance: Includes instances for the dimension.
nonrepeating instance: Includes unique instances (non-repeating) for the dimension. This is the model applied in Flow when repeat instances are excluded.