Segments: Segments

Description Usage Arguments Value Methods (by class) See Also Examples

Description

Get the list of segments from the object or coerce the supplied objects into a a named list of segments.

Set the segments of the query object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Segments(object, ...)

Segments(object) <- value

## S4 method for signature 'gaSegmentList'
Segments(object)

## S4 method for signature 'gaQuery'
Segments(object)

## S4 method for signature 'ANY'
Segments(object)

## S4 replacement method for signature 'gaQuery'
Segments(object) <- value

Arguments

object

A query object to get the segment list from or to set the segment list of.

...

Alternatively, provide one or more named arguments (segments or objects that can be coerced into segments) including dynamic segments, built-in and/or custom segments by their ID.

value

A named list of segments or a single segment.

Value

A gaSegmentList

Methods (by class)

See Also

Other dynamic segment functions: DynSegment, Exclude, Include, IsNegated, PerHit, PerProduct, PerSession, PerUser, ScopeLevel, SegmentConditionFilter, Segment

Other dynamic segment functions: DynSegment, Exclude, Include, IsNegated, PerHit, PerProduct, PerSession, PerUser, ScopeLevel, SegmentConditionFilter, Segment

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
my_segments <- Segments(list(
  bounces = PerSession(Expr(~bounces != 0)),
  conversions = PerUser(Expr(~goalCompletionsAll > 0) | Expr(~transactions > 0)),
  mobile_or_tablet = Expr(~deviceCategory %in% c("mobile", "tablet")),
  multi_session_users = Include(PerUser(Expr(~sessions > 1)), scope = "users"),
  new_desktop_users = Expr(~deviceCategory == "desktop") & Expr(~userType == "new")
))

my_query <- GaQuery(view = "987654321")
my_segments_list <- list(
  bounces = PerSession(Expr(~bounces != 0)),
  conversions = PerUser(Expr(~goalCompletionsAll > 0) | Expr(~transactions > 0)),
  mobile_or_tablet = Expr(~deviceCategory %in% c("mobile", "tablet")),
  multi_session_users = Include(PerUser(Expr(~sessions > 1)), scope = "users"),
  new_desktop_users = Expr(~deviceCategory == "desktop") & Expr(~userType == "new")
)
Segments(my_query) <- my_segments_list

jdeboer/ganalytics documentation built on May 18, 2019, 11:30 p.m.