Meet Toki Operator

Docs/Manage API

Analytics

The stats, charts and tables from the Analytics page.

The numbers behind the Analytics page in the Toki app. analyticsStatsBlocks returns stat cards by ID; analyticsStatsChart returns current and previous chart series. Report operations return TokiAnalyticsTable objects whose columns tell you how to read each row's cells. Dates are ISO 8601 date-times and amounts are in your store currency.

Operations12 queries · 0 mutations
query

analyticsStatsChart#

Returns a metric's chart for the selected period and the preceding comparison period. Uses the same stored analytics and comparison dates as the portal chart.

Arguments

  • startDateString

    Start date, in ISO 8601 format. Defaults to 2021-01-01.

  • endDateString

    End date, in ISO 8601 format. Defaults to now.

  • blockString!Required

    Metric ID, such as users.total, sales.aov or points.rewarded.

  • segmentIds[String!]

    Segment filter. Only the first ID is used; empty means all members.

  • periodTokiAnalyticsStatsChartPeriod

    Bucket interval. Defaults to days.

    daysweeksmonths
  • asMoneyBoolean

    Convert values using the default store credit's conversion rate. Does not affect sales.aov.

  • forAllShopsBoolean

    Use the merchant's aggregate across all stores instead of the current store.

Returns

TokiAnalyticsStatsChartPayload!

Current and previous chart series.

  • currentTokiAnalyticsStatsChartCurrent!

    A metric's values over one comparison period.

  • previousTokiAnalyticsStatsChartCurrent!

    A metric's values over one comparison period.

query AnalyticsStatsChart($block: String!) {
  analyticsStatsChart(block: $block) {
    current {
      name
      data {
        key
        value
      }
    }
    previous {
      name
      data {
        key
        value
      }
    }
  }
}
Variables
{
  "block": "Block"
}
Response
{
  "data": {
    "analyticsStatsChart": {
      "current": {
        "name": "Gold",
        "data": [
          {
            "key": "Key",
            "value": 49.99
          }
        ]
      },
      "previous": {
        "name": "Gold",
        "data": [
          {
            "key": "Key",
            "value": 49.99
          }
        ]
      }
    }
  }
}
query

analyticsStatsBlocks#

Computes stat cards from the Analytics page for a period: one entry per ID in blocks, in the same order. Each diff compares the value with the period of the same length just before startDate; the period defaults to 2021-01-01 through now.

Arguments

  • startDateString

    Start of the period, as an ISO 8601 date-time.

  • endDateString

    End of the period, as an ISO 8601 date-time.

  • forAllShopsBoolean

    true includes all your stores instead of only the current one. Some stats and tables always cover all your stores and ignore it.

  • blocks[String!]!Required

    IDs of the stats to compute, such as users.total, users.active, sales.orders.volume, sales.aov, revenue.loyalty, referrals.sent or activities.completed. Point stats (points.rewarded, points.manuallyGiven, points.redeemed, points.applied, points.expired) return totals; add .count for the number of members. Tier stats take the tier's ID, as in tiers.<tierId>.newCustomers.

  • segmentIds[String!]

    Segment IDs to filter by, the same as the Segments filter on the Analytics page.

  • asMoneyBoolean

    true returns point totals as their value in your store currency, converted at each store credit's default conversion rate. Counts aren't affected.

Returns

[TokiAnalyticsStatsBlocksPayload!]!

One stat card's value for the period.

  • blockString!

    The stat ID, as requested.

  • valueFloat

    The stat for the period, such as a count, points or an amount in your store currency. Rates are fractions (0.25 is 25%). null for an unknown ID.

  • diffFloat

    The change from the period of the same length before startDate, in percent; for revenue.roi and the repeat purchase rates, the difference between the two values. 0 when either value is zero or missing, null for an unknown ID.

query AnalyticsStatsBlocks($blocks: [String!]!) {
  analyticsStatsBlocks(blocks: $blocks) {
    block
    value
    diff
  }
}
Variables
{
  "blocks": [
    "Blocks"
  ]
}
Response
{
  "data": {
    "analyticsStatsBlocks": [
      {
        "block": "Block",
        "value": 49.99,
        "diff": 1.5
      }
    ]
  }
}
query

analyticsDailyUserMetricsOverviewTable#

Returns the Daily Users Metrics Overview table: a column for each day from startDate to endDate, and rows for total members, active members, activities completed, and points earned and spent in your default store credit. It always covers all your stores.

Arguments

  • startDateString

    Start of the period, as an ISO 8601 date-time.

  • endDateString

    End of the period, as an ISO 8601 date-time.

  • forAllShopsBoolean

    true includes all your stores instead of only the current one. Some stats and tables always cover all your stores and ignore it.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsDailyUserMetricsOverviewTable {
  analyticsDailyUserMetricsOverviewTable {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Response
{
  "data": {
    "analyticsDailyUserMetricsOverviewTable": {
      "id": "2c0d2ca2-2d0d-4e35-aa0d-297c2b0d2b0f",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}
query

analyticsActivityCompletionsGrowthTable#

Returns the Activity Completions Growth table: a row for each activity name with its completions in each month of the period, whatever their status, and a total column with its approved completions of all time. The period defaults to the last three months; the table always covers all your stores.

Arguments

  • startDateString

    Start of the period, as an ISO 8601 date-time.

  • endDateString

    End of the period, as an ISO 8601 date-time.

  • forAllShopsBoolean

    true includes all your stores instead of only the current one. Some stats and tables always cover all your stores and ignore it.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsActivityCompletionsGrowthTable {
  analyticsActivityCompletionsGrowthTable {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Response
{
  "data": {
    "analyticsActivityCompletionsGrowthTable": {
      "id": "6016d4f7-5f16-4364-a216-d81d6116d68a",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}
query

analyticsActivityCompletionsTable#

Lists approved activity completions in the period (all time without dates), newest first, as the Activity Completions table: the member's email and name, the reward, the activity and when it was completed. Pass activityId for one activity; the table always covers all your stores.

Arguments

  • startDateString

    Start of the period, as an ISO 8601 date-time.

  • endDateString

    End of the period, as an ISO 8601 date-time.

  • forAllShopsBoolean

    true includes all your stores instead of only the current one. Some stats and tables always cover all your stores and ignore it.

  • activityIdString

    Only completions of this activity.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsActivityCompletionsTable($first: Int) {
  analyticsActivityCompletionsTable(first: $first) {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Variables
{
  "first": 10
}
Response
{
  "data": {
    "analyticsActivityCompletionsTable": {
      "id": "49e6ae08-4ae6-4f9b-abe6-b12e4ce6b2c1",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}
query

analyticsTopReferrersTable#

Returns the Top Referrers table: up to 20 members whose referrals led to the most orders, with their membership, link clicks (sent), referred orders (redeemed), activation (orders per click) and the revenue of those orders. It counts clicks made in the period (all time without dates).

Arguments

  • startDateString

    Start of the period, as an ISO 8601 date-time.

  • endDateString

    End of the period, as an ISO 8601 date-time.

  • forAllShopsBoolean

    true includes all your stores instead of only the current one. Some stats and tables always cover all your stores and ignore it.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsTopReferrersTable {
  analyticsTopReferrersTable {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Response
{
  "data": {
    "analyticsTopReferrersTable": {
      "id": "a0af138b-9faf-41f8-a2af-16b1a1af151e",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}
query

analyticsAllReferralActionsTable#

Lists referral actions in the period (all time without dates), newest first, as the All referral actions table. Each row is a Link click, or an Order made once the friend ordered with the referral discount, with the referrer's name, email and membership, the discount code, and the order ID and revenue.

Arguments

  • startDateString

    Start of the period, as an ISO 8601 date-time.

  • endDateString

    End of the period, as an ISO 8601 date-time.

  • forAllShopsBoolean

    true includes all your stores instead of only the current one. Some stats and tables always cover all your stores and ignore it.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsAllReferralActionsTable($first: Int) {
  analyticsAllReferralActionsTable(first: $first) {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Variables
{
  "first": 10
}
Response
{
  "data": {
    "analyticsAllReferralActionsTable": {
      "id": "761614d7-7516-4344-a816-17fd7716166a",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}
query

analyticsReferralsByMembershipHoldersTable#

Returns the Referrals made by membership holders table: referred orders in each month of the last three months, with a row for each referrer membership and No Membership for referrers who hold none.

Arguments

  • forAllShopsBoolean

    true includes all your stores instead of only the current one.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsReferralsByMembershipHoldersTable {
  analyticsReferralsByMembershipHoldersTable {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Response
{
  "data": {
    "analyticsReferralsByMembershipHoldersTable": {
      "id": "82b9c32c-83b9-44bf-a4b9-c65285b9c7e5",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}
query

analyticsTierGrowthTable#

Returns the Tier Growth table: how many members entered each membership in each month of the last three months, one row per membership in tier order.

Arguments

  • forAllShopsBoolean

    true includes all your stores instead of only the current one.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsTierGrowthTable {
  analyticsTierGrowthTable {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Response
{
  "data": {
    "analyticsTierGrowthTable": {
      "id": "37ef9935-36ef-47a2-a5ef-960f34ef947c",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}
query

analyticsTiersOverviewTable#

Returns the Tiers Overview table: each membership's current number of members and the revenue from its members' orders, in tier order.

Arguments

  • forAllShopsBoolean

    true includes all your stores instead of only the current one.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsTiersOverviewTable {
  analyticsTiersOverviewTable {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Response
{
  "data": {
    "analyticsTiersOverviewTable": {
      "id": "71681716-7268-48a9-af68-13f070681583",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}
query

analyticsPaidMembershipsOverviewTables#

Returns the Paid Memberships Overview tables, one for each active paid membership and billing interval, with a column per day, week or month and the rows Total, New + Renewals, Renewed, New and Churned. Each date cell's value is an object with count and revenue, the count times the plan's price. Without both startDate and endDate, the tables cover six periods up to endDate or now.

Arguments

  • startDateString

    Start of the period, as an ISO 8601 date-time.

  • endDateString

    End of the period, as an ISO 8601 date-time.

  • forAllShopsBoolean

    true includes all your stores instead of only the current one. Some stats and tables always cover all your stores and ignore it.

  • typeTokiAnalyticsPaidMembershipsOverviewTablesType

    How much time each column covers. Defaults to months.

    daysweeksmonths

Returns

[TokiAnalyticsTable!]!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsPaidMembershipsOverviewTables {
  analyticsPaidMembershipsOverviewTables {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Response
{
  "data": {
    "analyticsPaidMembershipsOverviewTables": [
      {
        "id": "3b5bcfef-3a5b-4e5c-ad5b-d3153c5bd182",
        "title": "Summer double points",
        "columns": [
          {
            "key": "Key",
            "label": "Summer double points",
            "type": "string",
            "align": "left"
          }
        ]
      }
    ]
  }
}
query

analyticsManualRewardsTable#

Lists manual balance adjustments in your default store credit in the period (all time without dates), newest first, as the Manually Given table: the member's email, the amount in points, your description and the date. Debits are included too, also as positive amounts, and the table covers all your stores.

Arguments

  • startDateString

    Start of the period, as an ISO 8601 date-time.

  • endDateString

    End of the period, as an ISO 8601 date-time.

  • forAllShopsBoolean

    true includes all your stores instead of only the current one. Some stats and tables always cover all your stores and ignore it.

Returns

TokiAnalyticsTable!

A table from the Analytics page, as columns and rows.

  • idID

    Identifies the table, such as top-referrers.

  • titleString

    The table's title on the Analytics page.

  • columns[TokiAnalyticsTableColumns!]!

    The table's columns, in display order.

  • rowsTokiAnalyticsTableRowConnection!

    The table's rows. Without arguments, every row the operation loaded.

query AnalyticsManualRewardsTable($first: Int) {
  analyticsManualRewardsTable(first: $first) {
    id
    title
    columns {
      key
      label
      type
      align
    }
  }
}
Variables
{
  "first": 10
}
Response
{
  "data": {
    "analyticsManualRewardsTable": {
      "id": "f55f7b6e-f65f-4d01-a35f-7848f45f79db",
      "title": "Summer double points",
      "columns": [
        {
          "key": "Key",
          "label": "Summer double points",
          "type": "string",
          "align": "left"
        }
      ]
    }
  }
}