Analytics Target
Requires access scope.
Represents a merchant-defined goal for a specific analytics metric over a date range. Merchants use analytics targets to track progress toward business objectives, such as reaching a total sales amount or a number of orders within a given period.
Each target is associated with a single metric and can optionally include filter expressions to
narrow the evaluated data. Use the
query
to retrieve targets, and the
,
,
and
mutations to manage them.
Anchor to FieldsFields
- createdAt (DateTime!)
- currencyCode (CurrencyCode!)
- endDate (Date!)
- expectedValue (Decimal!)
- filters (String)
- id (ID!)
- metric (String!)
- name (String!)
- presentmentExpectedValue (MoneyV2)
- shopifyqlQuery (String)
- startDate (Date!)
- updatedAt (DateTime!)
- Anchor to createdAtcreated•Date
At Time! non-null The date and time when the analytics target was created.
- Anchor to currencyCodecurrency•Currency
Code Code! non-null The currency code stored on the target's expected value. Defaults to the shop currency when the target is created.
- Anchor to endDateend•Date!
Date non-null The end date of the period over which progress toward the target is measured.
- Anchor to expectedValueexpected•Decimal!
Value non-null The goal value that the merchant aims to reach for the tracked metric within the target period. Must be greater than 0.
- Anchor to filtersfilters•String
An optional filter expression to narrow the data evaluated against this target. For example,
.- •ID!non-null
A globally-unique ID.
- Anchor to metricmetric•String!non-null
The identifier of the analytics metric that this target tracks, such as
ororders.- Anchor to namename•String!non-null
A human-readable label for the target, such as
Q1 Sales Target.- Anchor to presentmentExpectedValuepresentment•Money
Expected Value V2 The target's expected value converted to a specified presentment currency. Returns
nullwhen the target metric isn't a money metric or the conversion rate is unavailable.- Anchor to currencyCodecurrency•Currency
Code Code! required The currency code to convert the expected value into.
Arguments
- Anchor to shopifyqlQueryshopifyql•String
Query A generated ShopifyQL query string that fetches the current value of the tracked metric for this target's date range and filters.
- Anchor to startDatestart•Date!
Date non-null The start date of the period over which progress toward the target is measured.
- Anchor to updatedAtupdated•Date
At Time! non-null The date and time when the analytics target was last updated.
Anchor to QueriesQueries
- analyticsTargets (AnalyticsTargetConnection!)
- •query
Returns a paginated list of analytics targets for the shop. Each target represents a merchant-defined goal for a specific metric over a date range.
Results can be filtered by metric, name, date range, or filter expression, and sorted by fields such as
,, ormetric.- Anchor to firstfirst•Int
The first
nelements from the paginated list.- Anchor to afterafter•String
The elements that come after the specified cursor.
- Anchor to lastlast•Int
The last
nelements from the paginated list.- Anchor to beforebefore•String
The elements that come before the specified cursor.
- Anchor to reversereverse•BooleanDefault:false
Reverse the order of the underlying list.
- Anchor to sortKeysort•Analytics
Key Target Sort Keys Default:ID Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
- Anchor to queryquery•String
A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
- Anchor to default•string
Filter by a case-insensitive search of multiple fields in a document.
query=Bob Normanquery=title:green hoodie- Anchor to end_date•date
Filter by the end date of the target period.
end_date:2026-03-31end_date:<=2026-03-31- Anchor to filters•string
Filter by the target's filter expression.
filters:"shipping_country = 'US'"- Anchor to start_date•date
Filter by the start date of the target period.
start_date:2026-01-01start_date:>=2026-01-01
Example:
Example:
Example:
Example:
Arguments
Anchor to MutationsMutations
- analyticsTargetCreate (AnalyticsTargetCreatePayload)
- analyticsTargetUpdate (AnalyticsTargetUpdatePayload)
- •mutation
Creates an analytics target that defines a merchant's goal for a specific metric over a date range. For example, a merchant can set a target of $50,000 in total sales for a quarter, or 1,000 orders in a month.
Provide the target attributes through the
inputargument. The target's currency is set to the shop's currency. A target is uniquely identified by the combination ofmetric,,, andfilters— attempting to create a duplicate returns a user error.- Anchor to inputinput•Analytics
Target Create Input! required The input fields for creating an analytics target.
Arguments
- •mutation
Updates an existing analytics target. Only the fields provided in the
inputargument are modified; omitted fields remain unchanged. Setting a nullable field tonullclears its value.- •ID!required
The ID of the analytics target to update.
- Anchor to inputinput•Analytics
Target Update Input! required The input fields for updating an analytics target.
Arguments
- •ID!