Zendesk PowerMetric Examples from Klipfolio Support Team

Here are some of our favourite PowerMetric examples using Zendesk data. We are Zendesk API power users and have learned a number of tricks to working with the queries, using XPath to align data and track some of our most useful metrics. 


  • 0
    Meggan King

    Zendesk Tag Tracking: Issues Raised

    Track the issues raised using Zendesk Ticket Form tagging.

    Klipfolio support team uses multiple subsystem tags for each ticket opened to track the type of questions customers ask. 

    Depending on your support workflow, you might want to add tags to provide more context for the request so that tickets can be viewed and tracked, or processed by your account's business rules.


    Why track issues raised? 

    Tracking ticket issues helps uncover trends and gather granular data which can be used to adjust your support strategy. Over time - as PowerMetrics store and track your historic information - you can analyze tag use to understand support request trends.


    Interesting notes with using Zendesk API

    For our example, we used a fairly general Zendesk API query and fetch only 1 day at a time. Because PowerMetrics stores history for us, we will build up our view each day and do not need to worry about pagination:

    Here is an example of the query we used

    GET  https://<YourOrganizationHere>.zendesk.com/api/v2/search.json?page=1&per_page=100&query=type:ticket+created_at>={date.yesterday.format()}T00:00:00Z%20created_at<={date.yesterday.format()}T23:59:59Z&sort_by=created_at&sort_order=desc

    (We've used our dynamic data parameters in the query to calculate date correctly each day)

    Getting access to the tag information requires using XPath in the model. In Klipfolio, we allow multiple tags per ticket, so you need to align Ticket Ids and Created Date to the tags. 


    Each tag type has a unique id you can see in the data:

    XPath for the tag types we want to track, under custom_fields, with id = '360003475593'





    XPath to repeat ticket id and created date by value:

    This trick repeat ticket details per sub-system type tag (which can be many)




    Once you've made the model, it is quick to create that PowerMetric. All the date pickers, filters and chart types are built-in, so you can check out the data many ways.





  • 0
    Meggan King

    Daily Ticket Trend (by created date)

    Track tickets created on a daily chart

    Use previous period to compare over time.


    Using the same data source as the example above, we create a new model and just select Created At time and Ticket Id. This PowerMetric allows you to just track tickets created over time. You can easily take advantage of the PowerMetrics built-in date pickers, Trends and Previous Period


  • 0
    Meggan King

    Zendesk Tag Tracking: Ticket Form Fields

    Track tickets by custom tag on ticket forms in Zendesk, then access that data for PowerMetric.

    One useful tag Klipfolio uses is to tag every ticket with a mandatory : customer, trial or other 


    Again, we use the same data source as first example, but create a new model to track these details (Note, you can create a single model with many measures and dimensions as well)


    Why it is useful

    Tracking over time to see who is opening the most tickets and help your support team target information more specifically. Ticket forms and tags help your team to deliver an accurate and speedy resolution. 


    Interesting Notes

    Getting access to the tag information requires XPath in the model


    Xpath - every custom field/tag in a Zendesk ticket form has a unique ID

    Because this is a mandatory field, it is available in every ticket and you don’t need to worry about filling in missing data or anything




  • 0
    Taya Davison

    Percent of Priority Support Tickets

    Use a calculated PowerMetric to track the percentage of your total support tickets that are coming from customers with Priority Support.


    To pull in this data, we used the Zendesk search api endpoint to access ticket data:

    GET https://<Your_Domain_Here>.zendesk.com/api/v2/search.json?page=1&per_page=100&query=type:ticket+created_at


    Next, we need to model the Data source. Getting access to the Ticket ID and Created Date is pretty simple. However, Priority support is a tag on the ticket that isn't on every ticket. This requires a bit of XPath to access it.

    To access the ID's of the tickets that have priority support tag:


    Then we can use LOOKUP to align with the rest of the ID's:




    REPEAT( "Priority Support", COUNT(@/results[tags='priority_support']/id) )


    Then we can create a PowerMetric on the count of tickets. And make sure the Priority Support column is a segment.

    Finally, we create a Calculated PoewrMetric where we divide the PowerMetric by itself. Filter the numerator to only include Priority Support tickets. This gives the percent of the total tickets!



    We can use different visualizations, like showing the aggregated percent with a comparison to previous period:

    Or showing the percent over time:

  • 0
    Taya Davison

    Average Hours to First Reply Time

    Keep track of the average first response time to your tickets and compare across different agents and office locations.


    Why is it useful?

    Because PowerMetrics stores historical data, we can track the first response time to tickets and compare day over day, month over month. This is a good way to make sure tickets are getting answered within the desired time frame and compare the average over time. 

    You can also use model merge to compare the average response time over different agents and locations. 


    First, to create a basic PowerMetric showing the average First response time, we can use the Zendesk Ticket Metrics endpoint. The query looks something like this:

    GET https://<Your_Domain_Here>.zendesk.com/api/v2/ticket_metrics.json?page=1

    This pulls in things like the ticket ID, the created date, and the first reply time in minutes. To get the first reply time in minutes, requires a little bit of xpath using kf:fill_elements(). This is because the first reply time field is blank until a ticket gets a reply, so we need to make sure we align the data.



    To get it in Hours, we can just divide by 60. WE can also use Date convert to convert the Created date into Months and Days. 


    If we format it as text, we can use that as a segment to compare the reply time for different days.


    Then, to be able to segment by agent and time zone/location we need to merge data sources. This data source doesn't include anything about the assigned agent so we need to pull in that info. 

    To do that, we can pull in the 100 most recent tickets using the search endpoint from Zendesk and match up the Ticket IDs. 

    GET https://<Your_Domain_Here>.zendesk.com/api/v2/search.json?page=1&per_page=100&query=type:ticket&sort_by=created_at&sort_order=desc

    From this data source we want to pull in the Ticket id and the Assignee ID. Then we can merge the data sources based on ticket ID.

    Finally, we want to pull the Agent information from Zendesk

    GET https://<Your_Domain_Here>.zendesk.com/api/v2/search.json?query=type:user%20role:agent%20role:admin 

    In this data source we want to model the Agent ID, the Name, And any other interesting segments for example role (Agent vs Admin) and Timezone (to show different office locations.

    To get the Office Location from the Time Zone we used a simple SUBSTITUTE.

    Then we can merge this model with the other ones according to Agent ID.

    Now we can make our PowerMetric based on the Average of our Hours to First reply.

    Then we can play around with different segmentations and visualizations.

  • 0
    Taya Davison

    First Reply Time - Goals

    Most companies have a target time to respond to a ticket. Using the Zendesk ticket metrics API, you can track the number of tickets that met the goal, or were over.


    Query url:

    GET https://<Your_Domain_Here>.zendesk.com/api/v2/ticket_metrics.json?page=1


    Then, in the model we can use formulas to bucket the data into response time categories. :

    We can do this using the IF function and a bit of XPath manipulation to get the first reply time.

    kf:fill_elements to get the first reply time:


    Then choose the time periods you want to group by. For example <1, 1-8, 8-24, >24: 

        @kf:fill_elements(/ticket_metrics/reply_time_in_minutes,'business') < 60,
            @kf:fill_elements(/ticket_metrics/reply_time_in_minutes,'business') <= 480,
            IF( @kf:fill_elements(/ticket_metrics/reply_time_in_minutes,'business') <= 1440, "16-24", ">24" )


    Then you can also have a column that has values like "Met Goal" or "Over". You can use the same IF formula and decide how long your first reply time goal is:

        @kf:fill_elements(/ticket_metrics/reply_time_in_minutes,'business') = 0,
        "Not Tracked",
        IF( @kf:fill_elements(/ticket_metrics/reply_time_in_minutes,'business') <= xxx, "Met Goal", "Over" )

    Replace xxx with your preferred time.


    Then we can make a PowerMetric based on the count of ticket IDs with these columns as segments. And use different visualizations to display the information:


Please sign in to leave a comment.