简体   繁体   中英

Unable to build inline segments in RSiteCatalyst package in R

I am trying to build the inline segment to filter the pages (ex. to separate the pages for blogs and games) using the function BuildClassificationValueSegment() to get the data from Adobe Analytics API,

I have tried some thing like

report.data.visits <- QueueTrended(reportsuite.id,date.from,date.to,metrics,elements, segment.inline = BuildClassificationValueSegment("evar2","blog","OR")).

Got error like :

Error in ApiRequest(body = report.description, func.name = "Report.Validate") : ERROR: segment_invalid - Segment "evar2" not valid for this company In addition: Warning message: In if (segment.inline != "") { : the condition has length > 1 and only the first element will be used

Please help on the same.Thanks in advance...

I recommend you to declare the InlineSegment in advance and store it in a variable. Then pass it to the QueueTrended function.

I've been using the following syntax to generate an inline segment:

       InlineSegment <- list(container=list(type=unbox("hits"), 
                         rules=data.frame(
                            name=c("Page Name(eVar48)"),
                            element=c("evar48"), 
                            operator=c("equals"),
                            value=c(as.character("value1","value2"))
                         ))

You can change the name and element arguments in order to personalize the query.

The next step is to pass the InlineSegment to the QueueRanked function:

Report  <-  as.data.frame(QueueRanked("reportsuite",
                                       date.from = dateStart,
                                       date.to = dateEnd,
                                       metrics = c("pageviews"),
                                       elements = c("element"),
                                       segment.inline = InlineSegment,
                                       max.attempts=500))

I borrowed that syntax from this thread some time ago: https://github.com/randyzwitch/RSiteCatalyst/issues/129

Please note that there might be easier ways to obtain this kind of report without using InlineSegmentation. Maybe you can use the selected argument from the QueueRanked function in order to narrow down the scope of the report.

Also, I'm purposefully avoiding the BuildClassificationValueSegment function as I found it a bit difficult to understand.

Hope this workaround helps...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM