seg_rule: Create the segment rule

View source: R/segment_rule.R

seg_ruleR Documentation

Create the segment rule

Description

This function creates the simple rule of a segment.

Usage

seg_rule(
  dimension = NULL,
  metric = NULL,
  verb = NULL,
  object = NULL,
  description = NULL,
  is_distinct = FALSE,
  attribution = "repeating",
  attribution_context = "visitors",
  validate = FALSE,
  rsid = Sys.getenv("AW_REPORTSUITE_ID"),
  company_id = Sys.getenv("AW_COMPANY_ID")
)

Arguments

dimension

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.

metric

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.

verb

Choose from any of the 30 different verbs. Use the seg_verbs package data to see all available verbs along with the descriptions.

object

This is the object of the rule and answers the question what or ⁠how many⁠

description

The internal description for the rule. (optional) This will not show in the UI but could be very helpful when using the API.

is_distinct

This will segment 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.”

attribution

Define the type of attribution. Either repeating (default), instance, or nonrepeating. See Details for more information.

attribution_context

When applying a non-repeating instance attribution model to a rule the context for the attribution must be visitors (default) or visits

validate

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.

rsid

Adobe report suite ID (RSID). If an environment variable called AW_REPORTSUITE_ID exists in .Renviron or elsewhere and no rsid argument is provided, then the AW_REPORTSUITE_ID value will be used. Use aw_get_reportsuites() to get a list of available rsid values.

company_id

Company ID. If an environment variable called AW_COMPANY_ID exists in .Renviron or elsewhere and no company_id argument is provided, then the AW_COMPANY_ID value will be used. Use get_me() to get a list of available company_id values.

Details

Attribution Models Available for dimensions only, these models determine what values in a dimension to segment for. Dimension models are particularly useful in sequential segmentation.

  • 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.

Value

A structured list defining the rule for a segment


adobeanalyticsr documentation built on Nov. 9, 2023, 5:07 p.m.