(Feature Request) Multiple Segments for QueueOvertime,QueueRanked & QueueTrended #129

Closed
anujsaxenaa opened this Issue Mar 16, 2015 · 16 comments

Comments

Projects
None yet
6 participants
@anujsaxenaa

Hi Randy,

Thank you for effort on creating such a useful package in R. I wanted to know if you can add a feature that lets us input a list of segments in a particular query. As many of the segments defined my company properties are not mutually exclusive, in many cases the correct numbers come out only when pick more multiple segments. Adobe Report Builder has this feature, but wanted to do it pragmatically.

I'm open to your suggestions to this issue.

Thanks,

Anuj

@janfait

This comment has been minimized.

Show comment
Hide comment
@janfait

janfait Mar 16, 2015

In addition to the above, I find it hard to pass the segment.inline parameter to any of the Queue reports. The error suggests the parameter should be a string, not a list or vector, but passing a JSON formatted string does not work either.

janfait commented Mar 16, 2015

In addition to the above, I find it hard to pass the segment.inline parameter to any of the Queue reports. The error suggests the parameter should be a string, not a list or vector, but passing a JSON formatted string does not work either.

@randyzwitch

This comment has been minimized.

Show comment
Hide comment
@randyzwitch

randyzwitch Mar 16, 2015

Owner

Hi @anujsaxenaa -

Could you be more specific about what you are looking for? Are you looking to do one report with multiple segments, like "Visitors from Mobile" and "Visitors from Germany"?

@janfait
Passing a JSON string shouldn't work in any function other than SubmitJsonQueueReport, and I'm questionable why I even agreed to export that function.

To create a segment.inline object, use BuildClassificationValueSegment, which will format the data in the proper R object to eventually be converted to the proper JSON.

Owner

randyzwitch commented Mar 16, 2015

Hi @anujsaxenaa -

Could you be more specific about what you are looking for? Are you looking to do one report with multiple segments, like "Visitors from Mobile" and "Visitors from Germany"?

@janfait
Passing a JSON string shouldn't work in any function other than SubmitJsonQueueReport, and I'm questionable why I even agreed to export that function.

To create a segment.inline object, use BuildClassificationValueSegment, which will format the data in the proper R object to eventually be converted to the proper JSON.

@anujsaxenaa

This comment has been minimized.

Show comment
Hide comment
@anujsaxenaa

anujsaxenaa Mar 16, 2015

Hi @randyzwitch

Correct. In your example, the data will be 'filtered' or satisfied by both segments 'Visitors from Mobile' & 'Visitors from Germany'. And the final metric value will be 'Visitors from Mobile from Germany'.

Hi @randyzwitch

Correct. In your example, the data will be 'filtered' or satisfied by both segments 'Visitors from Mobile' & 'Visitors from Germany'. And the final metric value will be 'Visitors from Mobile from Germany'.

@randyzwitch randyzwitch added this to the Scoping milestone Apr 17, 2015

@randyzwitch

This comment has been minimized.

Show comment
Hide comment
@randyzwitch

randyzwitch Apr 23, 2015

Owner

@anujsaxenaa, I'm fairly sure this isn't possible using the segment.id parameter, which appears to only accept a single string. You can use the current segment builder interface in Analytics to define a compound segment, then use GetSegments() in RSiteCatalyst to use that compound segment by referring to its id (i.e. the same exact process as now).

What I believe Adobe is doing in Report Builder and the Analytics interface is building inline segments, which is done in RSiteCatalyst by the awkwardly named BuildClassificationValueSegment. With that function you can specify the elements exactly as you want (although you can't pass two id values in of pre-existing segments), then pass the resulting list object into a Queue* function using the segment.inline argument.

I'm going to leave this open as a feature request, but my suggestion is to contact your Adobe representative and ask them to have one of their engineers submit a patch here if it is possible to do what you are looking for. I'm not an Adobe employee, and based on my reading of the documentation it doesn't look possible.

Owner

randyzwitch commented Apr 23, 2015

@anujsaxenaa, I'm fairly sure this isn't possible using the segment.id parameter, which appears to only accept a single string. You can use the current segment builder interface in Analytics to define a compound segment, then use GetSegments() in RSiteCatalyst to use that compound segment by referring to its id (i.e. the same exact process as now).

What I believe Adobe is doing in Report Builder and the Analytics interface is building inline segments, which is done in RSiteCatalyst by the awkwardly named BuildClassificationValueSegment. With that function you can specify the elements exactly as you want (although you can't pass two id values in of pre-existing segments), then pass the resulting list object into a Queue* function using the segment.inline argument.

I'm going to leave this open as a feature request, but my suggestion is to contact your Adobe representative and ask them to have one of their engineers submit a patch here if it is possible to do what you are looking for. I'm not an Adobe employee, and based on my reading of the documentation it doesn't look possible.

@randyzwitch randyzwitch added the wontfix label Apr 23, 2015

@anujsaxenaa

This comment has been minimized.

Show comment
Hide comment
@anujsaxenaa

anujsaxenaa Apr 27, 2015

@randyzwitch, I think I'm good with creating custom compound segments. That's what I was looking for actually. I did that in using Omniture SiteCatalyst's Segment Builder functionality (I'm guessing that's what you meant when you said 'segment builder interface in Analytics').

Could you confirm if it's possible to create compound segments within RSiteCatalyst using BuildClassificationValueSegment ?. I.E. it having similar functionality as Segment Builder present within Omniture SiteCatalyst. I think you did answer this query above, but it would be great in understanding this with an example for BuildClassificationValueSegment. I'm working on is creating a segment that gives you page views for say abc.com coming from Searches.

In addition, in a Queue Ranked report, we get raw breakdowns of values. Is there a way to get the output by the SAINT classification that we have applied. For e.g, I ran a QueueRanked report for "prop5", and the output had names like := food, food & wine etc. And their grouped values match that of the SAINT Classification (food) which is a custom section in Adobe report builder). So I was wondering if there is a way I can get hold of some kind of a lookup table which maps the Custom groups (SAINT) with the raw sections.

Feel free to advise, appreciate it greatly.

Thanks

Anuj

@randyzwitch, I think I'm good with creating custom compound segments. That's what I was looking for actually. I did that in using Omniture SiteCatalyst's Segment Builder functionality (I'm guessing that's what you meant when you said 'segment builder interface in Analytics').

Could you confirm if it's possible to create compound segments within RSiteCatalyst using BuildClassificationValueSegment ?. I.E. it having similar functionality as Segment Builder present within Omniture SiteCatalyst. I think you did answer this query above, but it would be great in understanding this with an example for BuildClassificationValueSegment. I'm working on is creating a segment that gives you page views for say abc.com coming from Searches.

In addition, in a Queue Ranked report, we get raw breakdowns of values. Is there a way to get the output by the SAINT classification that we have applied. For e.g, I ran a QueueRanked report for "prop5", and the output had names like := food, food & wine etc. And their grouped values match that of the SAINT Classification (food) which is a custom section in Adobe report builder). So I was wondering if there is a way I can get hold of some kind of a lookup table which maps the Custom groups (SAINT) with the raw sections.

Feel free to advise, appreciate it greatly.

Thanks

Anuj

@randyzwitch

This comment has been minimized.

Show comment
Hide comment
@randyzwitch

randyzwitch Apr 28, 2015

Owner

I'll have to get back to you after playing around a bit. Admittedly, I don't use RSiteCatalyst that much anymore, as I don't do digital analytics that much. But according to the documentation for BuildClassificationValueSegment, you should be able to pass them into a Queue* function as a list and use multiple segments.

Whether that actually works or not, we'll see :)

Owner

randyzwitch commented Apr 28, 2015

I'll have to get back to you after playing around a bit. Admittedly, I don't use RSiteCatalyst that much anymore, as I don't do digital analytics that much. But according to the documentation for BuildClassificationValueSegment, you should be able to pass them into a Queue* function as a list and use multiple segments.

Whether that actually works or not, we'll see :)

@tfindlay-au

This comment has been minimized.

Show comment
Hide comment
@tfindlay-au

tfindlay-au Jul 28, 2015

FWIW - I have managed to define multiple segments in R, but it wasnt pretty.

mySegment<- list(container=list(type=unbox("hits"),
rules=data.frame(
name=c("MobileDevices",'isDomestic'),
element=c("mobiledevicetype","geocountry"),
operator=c("equals","equals"),
value=c("Mobile Phone","Australia")
)))

This will filter on both elements. I can then supply "mySegment" into the Queue* methods like:
myResults<-QueueRanked(
reportsuite.id=my.rsid
,date.from=my.dates[1]
,date.to=my.dates[2]
,metrics=myMetrics
,elements=myElements
,selected=mySelected
,segment.inline=mySegment
)

FWIW - I have managed to define multiple segments in R, but it wasnt pretty.

mySegment<- list(container=list(type=unbox("hits"),
rules=data.frame(
name=c("MobileDevices",'isDomestic'),
element=c("mobiledevicetype","geocountry"),
operator=c("equals","equals"),
value=c("Mobile Phone","Australia")
)))

This will filter on both elements. I can then supply "mySegment" into the Queue* methods like:
myResults<-QueueRanked(
reportsuite.id=my.rsid
,date.from=my.dates[1]
,date.to=my.dates[2]
,metrics=myMetrics
,elements=myElements
,selected=mySelected
,segment.inline=mySegment
)

@randyzwitch

This comment has been minimized.

Show comment
Hide comment
@randyzwitch

randyzwitch Aug 11, 2015

Owner

Thanks for providing this @tfindlay-au! I think I need to make an update; my function BuildClassificationValueSegment was supposed to handle this situtation, but it doesn't appear that the function has the same arguments as you are using.

So if yours works, maybe I implemented this incorrectly.

Owner

randyzwitch commented Aug 11, 2015

Thanks for providing this @tfindlay-au! I think I need to make an update; my function BuildClassificationValueSegment was supposed to handle this situtation, but it doesn't appear that the function has the same arguments as you are using.

So if yours works, maybe I implemented this incorrectly.

@anujsaxenaa

This comment has been minimized.

Show comment
Hide comment
@anujsaxenaa

anujsaxenaa Dec 18, 2015

@tfindlay-au This worked for my use case as well. Thank you for figuring this out. Pretty useful stuff if one wants to create multiple segments on the fly.

@tfindlay-au This worked for my use case as well. Thank you for figuring this out. Pretty useful stuff if one wants to create multiple segments on the fly.

@pgsmith2000

This comment has been minimized.

Show comment
Hide comment
@pgsmith2000

pgsmith2000 Feb 4, 2016

@tfindlay-au Sorry if I caught this is the middle, but I am trying to do the same thing but wondered if you could answer a couple questions to clafify your code above (where you define mySegment)?

Are the values in the name parameter pre-existing segments (already defined in SiteCatalyst) or are you defining it inline?

Also, in the QueueRanked call you include mySegments in both the selected= and segment.inline= parameters. Is this required or can you just call a pre-existing segment?

I want to pull data using two (or more) segments I have created already in SiteCatalyst

@tfindlay-au Sorry if I caught this is the middle, but I am trying to do the same thing but wondered if you could answer a couple questions to clafify your code above (where you define mySegment)?

Are the values in the name parameter pre-existing segments (already defined in SiteCatalyst) or are you defining it inline?

Also, in the QueueRanked call you include mySegments in both the selected= and segment.inline= parameters. Is this required or can you just call a pre-existing segment?

I want to pull data using two (or more) segments I have created already in SiteCatalyst

@tfindlay-au

This comment has been minimized.

Show comment
Hide comment
@tfindlay-au

tfindlay-au Feb 5, 2016

@pgsmith2000 Lets see if I can help:

  1. The segments are not pre-defined in SiteCatalyst. You are correct, I am defining the segment using R code.
  2. If you read carefully, the call to QueueRanked specifies mySelected and mySegment. They are 2 different variables.

@pgsmith2000 Lets see if I can help:

  1. The segments are not pre-defined in SiteCatalyst. You are correct, I am defining the segment using R code.
  2. If you read carefully, the call to QueueRanked specifies mySelected and mySegment. They are 2 different variables.
@Gitzman

This comment has been minimized.

Show comment
Hide comment
@Gitzman

Gitzman Mar 16, 2016

Contributor

Sorry, I know I'm not helping here, but it does look like segment stacking is available in the Sitecatalyst Api https://marketing.adobe.com/developer/forum/reporting/stacking-segments-using-sitecatalyst-api

I am out of my element trying to tweak the Queue functions to accept a vector of segments and transform it into the format in the link, but if somebody in the community can figure it out, I would be very appreciative!

Thanks for all of the hard work everyone!

Contributor

Gitzman commented Mar 16, 2016

Sorry, I know I'm not helping here, but it does look like segment stacking is available in the Sitecatalyst Api https://marketing.adobe.com/developer/forum/reporting/stacking-segments-using-sitecatalyst-api

I am out of my element trying to tweak the Queue functions to accept a vector of segments and transform it into the format in the link, but if somebody in the community can figure it out, I would be very appreciative!

Thanks for all of the hard work everyone!

@Gitzman

This comment has been minimized.

Show comment
Hide comment
@Gitzman

Gitzman Mar 17, 2016

Contributor

I've made enough progress here in the QueueOvertime function where I am willing to use my local copy to actually accomplish this, but I have notice 2 oddities.

  1. If I make the request for only 1 day, the return df has the correct data matching the UI, but has two rows that are identical except for having a different value in the Seg id and seg name columns (so it duplicates the rows and makes one per segment). (Segment Name column of DF is removed from image for privacy)

image

image

  1. If I make the request for multiple days, the return df has only one row per day, but the seg id and seg name columns alternate between the segments every day. (Segment Name column of DF is removed from image for privacy)

image

image

My code changes are on my fork if you're interested in working on this. Otherwise, should I try and dedupe the single date return df and place all segment names in a list in the segment name column and do the same for segment ids? Idk what's best before pushing. Thoughts?

Contributor

Gitzman commented Mar 17, 2016

I've made enough progress here in the QueueOvertime function where I am willing to use my local copy to actually accomplish this, but I have notice 2 oddities.

  1. If I make the request for only 1 day, the return df has the correct data matching the UI, but has two rows that are identical except for having a different value in the Seg id and seg name columns (so it duplicates the rows and makes one per segment). (Segment Name column of DF is removed from image for privacy)

image

image

  1. If I make the request for multiple days, the return df has only one row per day, but the seg id and seg name columns alternate between the segments every day. (Segment Name column of DF is removed from image for privacy)

image

image

My code changes are on my fork if you're interested in working on this. Otherwise, should I try and dedupe the single date return df and place all segment names in a list in the segment name column and do the same for segment ids? Idk what's best before pushing. Thoughts?

@randyzwitch

This comment has been minimized.

Show comment
Hide comment
@randyzwitch

randyzwitch Mar 17, 2016

Owner

The convention is to submit a pull request. As you continue to work on this, before anything gets merged, your changes will continue to show up for everyone to evaluate.

Given the non-stable behavior you are witnessing, I suggest that you'll need to evaluate how the JSON response gets parsed.

Owner

randyzwitch commented Mar 17, 2016

The convention is to submit a pull request. As you continue to work on this, before anything gets merged, your changes will continue to show up for everyone to evaluate.

Given the non-stable behavior you are witnessing, I suggest that you'll need to evaluate how the JSON response gets parsed.

@Gitzman

This comment has been minimized.

Show comment
Hide comment
@Gitzman

Gitzman Mar 22, 2016

Contributor

RSiteCatalyst has been updated to allow for segment stacking on my pull request for all Queue() functions that take an segment.id

Contributor

Gitzman commented Mar 22, 2016

RSiteCatalyst has been updated to allow for segment stacking on my pull request for all Queue() functions that take an segment.id

@randyzwitch

This comment has been minimized.

Show comment
Hide comment
@randyzwitch

randyzwitch Mar 25, 2016

Owner

So I'm marking this correct, as @Gitzman implemented segment stacking. That has been merged into master for now. However, his code highlighted that the parser has been broken for an unknown amount of time, so that needs to be fixed before sending this feature off to CRAN.

I've created a new issue for @tfindlay-au answer above about defining segments on the fly for the segment.inline parameter, which is separate from what @Gitzman provided which is using multiple existing segments in the segment.id parameters.

Please do not make any more comments in this issue, as the discussion has become confusing. If you have questions related to this, either use #159 or use the master branch of RSiteCatalyst to use @Gitzman segment stacking functionality until it gets submitted to CRAN

Owner

randyzwitch commented Mar 25, 2016

So I'm marking this correct, as @Gitzman implemented segment stacking. That has been merged into master for now. However, his code highlighted that the parser has been broken for an unknown amount of time, so that needs to be fixed before sending this feature off to CRAN.

I've created a new issue for @tfindlay-au answer above about defining segments on the fly for the segment.inline parameter, which is separate from what @Gitzman provided which is using multiple existing segments in the segment.id parameters.

Please do not make any more comments in this issue, as the discussion has become confusing. If you have questions related to this, either use #159 or use the master branch of RSiteCatalyst to use @Gitzman segment stacking functionality until it gets submitted to CRAN

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