ganalytics (version 0.10.7)

Sequence: Sequence

Description

Create a new gaSequence object

Usage

Sequence(object, ..., negation, scope)

# S4 method for .compoundExpr Later(object)

# S4 method for .compoundExpr Then(object)

# S4 method for .compoundExpr First(object)

# S4 method for ANY Sequence(object, ..., negation, scope)

Arguments

object

A sequence step or another expression that should be coerced to a sequence condition.

...

Other steps within the sequence condition, in the order in which they should be applied.

negation

Logical TRUE or FALSE to match segments where this sequence has not occurred.

scope

Optional scope, "users" or "sessions".

Methods (by class)

  • .compoundExpr: Defines a sequence step using the supplied expression that does not need to be immediately at the start nor immediately following any preceding step.

  • .compoundExpr: Defines a sequential step using the supplied expression that should immediately follow any preceding step or be the very first required interaction in any sequences being matched to this sequential segment definition.

  • .compoundExpr: Alias to Then.

  • ANY: Return a sequence of one or more steps using the supplied expression(s) that define the steps, where those step can occur anywhere within the sequences of interactions being matched, but in the order specified.

See Also

Other sequence segment functions: First, Later, Then

Examples

Run this code
# NOT RUN {
expr1 <- Expr(~pagepath == "/")
expr2 <- Expr(~eventCategory == "video")
expr3 <- Expr(~timeOnPage > 10)
expr4 <- Expr(~transactionRevenue > 10)
expr5 <- expr1 & expr2
expr6 <- Expr(~eventAction == "click")
expr7 <- Expr(~eventCategory == "video") & Expr(~eventAction == "play")
expr8 <- Expr(~source == "google")
Segment(
  PerUser(
    expr1,        # treat an expression as 'condition type segment filter' by default
    PerHit(expr3)
  ),
  Sequence(
    expr2,
    Then(expr4),  # 'then' means 'immediately followed by'.
    Later(expr5)  # 'later' means 'followed by', but not necessarily immediately.
  ),
  Sequence(
    First(expr6), # First expressly means 'first interaction' within the date range.
    Then(expr7),  # By default, treat an expression within a sequence as happening
    expr8         # at any point after any preceding steps in the sequence, i.e. 'later'.
  )
)

# }

Run the code above in your browser using DataLab