Skip to content

Error when building sequential segments #142

Description

@abidawson

Hi there - thanks for your work on this package! I'm especially excited to see that you've exposed the ability to create segments via API and would love to see the capability to do calculated metrics as well.

I haven't been able to find examples for the segment-related functions in the docs yet (I assume you haven't gotten there) and I'm getting tripped up on creating sequential segments. I think there must be something wrong with my input below that's resulting in the error, maybe in what I'm supplying to the "sequences" argument of seg_build. If anyone can help I would much appreciate it!

Input:

#sequential segment
my_rule <- seg_rule(metric = "pageviews",
                    verb = "event-exists", 
                    validate = TRUE
)

my_rule_2 <- seg_rule(metric = "orders",
                      verb = "event-exists", 
                      validate = TRUE
)

my_sequence <- seg_seq(context = "visits",
                       rules = list(my_rule, my_rule_2),
                       sequence = "in_order")

seg_build(name = "Test Segment from API - Sequential",
          description = "pageviews exists then order exists",
          sequences = list(my_rule, my_rule_2, my_sequence),
          sequence_context = "visits",
          sequence = "in_order",
          context = "visitors",
          create_seg = TRUE
)

Output:

Error in handle_api_errors(resp = req, body = body) : 
  errorCode: invalid_data
errorDescription: Segment validation failed. HTTP 400 Bad Request - Segment validation failed, validation response was {"validator_version":"1.1.19","message":["Definition validation error"],"errors":[{"location":"container.pred.stream[0].pred","error":19,"message":"Invalid Sequence Implicit Context: must be \"visits\" or \"visitors\".","error-str":"InvalidSequenceImplicitContext"},{"location":"container.pred.stream[0].pred.stream","error":13,"message":"Empty Array: Empty arrays are not supported","error-str":"EmptyArray"},{"location":"container.pred.stream[1]","error":20,"message":"Invalid Sequence Stream: A sequence stream can only be calls to container(), sequence-and(), sequence-or(), time-restriction(), container-restriction(), dimension-restriction(), and exclude-next-checkpoint()","error-str":"InvalidSequenceStream"},{"location":"container.pred.stream[2]","error":20,"message":"Invalid Sequence Stream: A sequence stream can only be calls to contai

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions