Legacy Dev Forum Posts

 View Only

Sign Up

Group by Outboundcampaignid in useraggregates

  • 1.  Group by Outboundcampaignid in useraggregates

    Posted 06-05-2025 18:12

    matthew | 2017-06-15 19:06:59 UTC | #1

    Hi, I'm trying to use /api/v2/analytics/users/aggregates/query and get a groupby using Outboundcampaignid so we can see what times agents spend on each campaign.

    But I'm getting zero results.

    Can you let me know if this is a valid aggregation to try?

    thanks!


    anon28066628 | 2017-06-15 20:44:48 UTC | #2

    Hi Matthew it is - I'm not seeing any issue with my test org (see results.

    Have you tried the analytics query builder here? https://developer.mypurecloud.com/developer-tools/#/analytics-query-builder


    matthew | 2017-06-16 19:09:20 UTC | #3

    Hi, thanks for looking at this. that looks like the conversation aggregates results. I'm after the user status aggregates, trying to see how long they spend in the states while on a particular campaign. Is it possible ?


    matthew | 2017-06-19 12:23:51 UTC | #4

    just to clarify this more, i have been asked to retrieve metrics like time spent Onqueue/Offqueue, time spent in the organisational presence, time spent idle , time spent not responding - all filtered by the campaign in question.

    for example : /api/v2/analytics/users/aggregates/query

    query :

    {"interval":"2017-06-07T00:00:00/2017-06-10T00:00:00","granularity":"PT1H","groupBy":["outboundCampaignId","userId"],"filter":{"type":"and","clauses":[{"type":"or","predicates":[{"type":"dimension","dimension":"userId","value":"e110f0a9-a871-4ad6-b72a-d214206d74ed"},{"type":"dimension","dimension":"userId","value":"ea004fbf-3c56-4223-9d41-6453527df9fe"},{"type":"dimension","dimension":"userId","value":"12b8f7ec-d20b-4c89-b9b7-a8281522c466"}]},{"type":"or","predicates":[{"type":"dimension","dimension":"outboundCampaignId","value":"1af98c3e-1510-4796-9907-bf5f16284567"},{"type":"dimension","dimension":"outboundCampaignId","value":"6e626131-57fb-40fd-a693-2c185b573d46"},{"type":"dimension","dimension":"outboundCampaignId","value":"5189c2fb-b398-43a7-93fc-e791bee18998"}]}]}}

    please let me know if this is possible.

    thanks.


    tim.smith | 2017-06-19 19:46:46 UTC | #5

    I'm trying to use /api/v2/analytics/users/aggregates/query and get a groupby using Outboundcampaignid

    You can't. Per the documentation, "Filtering and group-by is limited to the userId dimension only."

    retrieve metrics like time spent Onqueue/Offqueue, time spent in the organisational presence, time spent idle , time spent not responding

    You can get these data points from POST /api/v2/analytics/users/aggregates/query or POST /api/v2/analytics/users/details/query, depending on the granularity you need.

    all filtered by the campaign in question

    That's going to make this considerably more difficult. Unfortunately, there isn't historical information about the user in the frame of reference of a campaign. To apply a "filter", you'll have to analyze the raw data and aggregate it yourself. An agent is available for a campaign if:

    • They are logged in to PureCloud, available, and on queue - this can be determined via the user details query.
    • They are logged in to a station - This information isn't available historically. You'll have to assume they were logged in.
    • They are a member of the queue used by the campaign - This information isn't available historically. You'll have to make assumptions based on the current configuration or use an external source to determine what queues they should have been active in.

    You can also use the conversation details for the user in the desired interval to determine which campaigns they took calls from. This could provide a hint as to which campaigns they were active in at the time.


    matthew | 2017-06-19 20:03:07 UTC | #6

    Thanks for the analysis Tim. Not an easy one to solve. I will talk with my colleagues about it, and try to do some workaround with the raw data.

    thanks.

    Matthew


    system | 2017-07-20 20:03:27 UTC | #7

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 1419