Filter Pendo API by product area and segment

Hi Pendo users, I built this functioning API script that extracts page related details by product area. Works great, but only give numbers for the "Everyone" segment. Is there a way to include a segment filter? I've tried to add the filter in multiple places and it does not work. Any help would be appreciated.

// Script Name: Monthly PageViews by Month by Product Area
// Description: Use this script to get PageViews, UniqueAccounts, UniqueVisitors from Pendo filter by Product Area. This is the same data fround in Product > Product Areas and filters by "D1P Risk Manager"

{
  "response": {
    "mimeType": "application/json"
  },
  "request": {
    "name": "PageEvents",
    "pipeline": [
      {
        "source": {
          "timeSeries": {
            "first": "now()",
            "count": -1,
            "period": "monthRange"
          },
          "pageEvents": {
            "pageId": "*"
          }
        }
      },
      {
        "merge": {
          "fields": ["pageId"],
          "mappings": {
            "productArea": "productArea"
          },
          "pipeline": [
            {
              "source": {
                "groups": {
                  "groupType": "group",
                  "items": true
                }
              }
            },
            {
              "unwind": {
                "field": "items"
              }
            },
            {
              "filter": "items.itemType == `Page`"
            },
            {
              "select": {
                "productArea": "name",
                "pageId": "items.itemId"
              }
            }
          ]
        }
      },
      {
        "filter": "productArea == `D1P Activity Center`"
      },
      {
        "select": {
          "month": "month",
          "pageId": "pageId",
          "numEvents": "numEvents",
          "accountId": "accountId",
          "visitorId": "visitorId"
        }
      },
      {
        "group": {
          "group": ["month", "pageId"],
          "fields": {
            "PageViews": { "sum": "numEvents" },
            "UniqueAccounts": { "count": "accountId" },
            "UniqueVisitors": { "count": "visitorId" }
          }
        }
      },
      {
        "sort": ["month"]
      }
    ],
    "requestId": "PageEvents"
  }
}




0

コメント

0件のコメント

サインインしてコメントを残してください。

お探しのものを見つけられませんでしたか?

新規投稿