Retrieve all NPS Responses for a specific visitorId via the API?
Greetings!
I am trying to fetch all of the NPS responses (and the visitor comments) for a specific visitorId.
If I fetch all NPS responses of all visitors (using an extreme 10 year timeSeries), it takes ~10 minutes to return all ~700 NPS responses.
If I add the filter for 1 specific visitorId (see the filter: 'visitorId == "f471fd..." below), I successfully get the 4 responses for the 1 visitor, but it takes ~2 minutes.
2 minutes is a long time for just 4 results, so I'm sure I'm doing something wrong in the pipeline definition.
Is there some way to optimize this query?
Thanks!
===========================
const timeSeries = {
I am trying to fetch all of the NPS responses (and the visitor comments) for a specific visitorId.
If I fetch all NPS responses of all visitors (using an extreme 10 year timeSeries), it takes ~10 minutes to return all ~700 NPS responses.
If I add the filter for 1 specific visitorId (see the filter: 'visitorId == "f471fd..." below), I successfully get the 4 responses for the 1 visitor, but it takes ~2 minutes.
2 minutes is a long time for just 4 results, so I'm sure I'm doing something wrong in the pipeline definition.
Is there some way to optimize this query?
Thanks!
===========================
const timeSeries = {
period: 'dayRange',
count: days + 1,
first: startTime,
}
const request = {
name: 'NPSResponses',
pipeline: [
{
source: {
pollEvents: {
guideId,
pollId: pollId1,
},
timeSeries,
},
},
{
filter: 'visitorId == "f471fdd2...<obfuscated>...7ab9ac7533d6"', // this takes 2 min to get response back from Pendo!
},
{
identified: 'visitorId',
},
{
merge: {
fields: ['visitorId', 'browserTime'],
mappings: {
followUpResponse: 'followUpResponse',
},
pipeline: [
{
source: {
pollEvents: {
guideId,
pollId: pollId1,
},
timeSeries,
},
},
{
identified: 'visitorId',
},
{
merge: {
fields: ['visitorId'],
mappings: {
followUpResponses: 'responses',
},
pipeline: [
{
source: {
pollEvents: {
guideId,
pollId: pollId2,
},
timeSeries,
},
},
{
identified: 'visitorId',
},
{
sort: ['browserTime'],
},
{
eval: {
'responseObj.pollResponse': 'pollResponse',
'responseObj.browserTime': 'browserTime',
},
},
{
group: {
group: ['visitorId', 'accountId'],
fields: [
{
responses: {
list: 'responseObj',
},
},
],
},
},
],
},
},
{
unwind: {
field: 'followUpResponses',
},
},
{
filter: 'followUpResponses.browserTime >= (browserTime - 100) && followUpResponses.browserTime < (browserTime + 100)',
// 'visitorId == "f471fdd2-8b79-4d2f-8c2e-7ab9ac7533d6" && followUpResponses.browserTime >= (browserTime - 100) && followUpResponses.browserTime < (browserTime + 100)',
},
{
group: {
group: ['visitorId', 'accountId', 'pollResponse', 'browserTime'],
fields: [
{
followUpResponses: {
first: 'followUpResponses',
},
},
],
},
},
{
eval: {
followUpResponse: 'followUpResponses.pollResponse',
},
},
],
},
},
{
bulkExpand: {
account: {
account: 'accountId',
},
},
},
{
eval: {
account_auto_id: 'account.auto.id',
},
},
{
select: {
visitorId: 'visitorId',
browserTime: 'browserTime',
accountId: 'account_auto_id',
comment: 'followUpResponse',
score: 'pollResponse',
channel: 'type',
},
},
],
requestId: 'NPSResponses',
}
0
Comments
Please sign in to leave a comment.