You can now enable the capability on metafield and metaobject definitions that you declare in shopify.app.toml. Merchants can then use those metafields and metaobjects as dimensions and filters in Shopify Analytics and ShopifyQL. Previously, you could set this capability only through the GraphQL Admin API.
What changed
Declarative definitions accept a new capability: . When it's true, the definition's values become queryable in analytics, the same as when you set with the ,, , and mutation.
[customer.metafields.app.membership_level]
name = "Membership level"
type = "single_line_text_field"
capabilities.analytics_queryable = true
[metaobjects.app.ingredient]
name = "Ingredient"
capabilities.analytics_queryable = true
[metaobjects.app.ingredient.fields.name]
type = "single_line_text_field"
name = "Name"
[metaobjects.app.ingredient.fields.calories]
type = "number_integer"
name = "Calories"
[customer.metafields.app.membership_level]
name = "Membership level"
type = "single_line_text_field"
capabilities.analytics_queryable = true
[metaobjects.app.ingredient]
name = "Ingredient"
capabilities.analytics_queryable = true
[metaobjects.app.ingredient.fields.name]
type = "single_line_text_field"
name = "Name"
[metaobjects.app.ingredient.fields.calories]
type = "number_integer"
name = "Calories"Release your app version with shopify app deploy, and Shopify distributes the definition to every shop where your app is installed.
What you need to know
- The capability is available for customer, order, product, and product variant metafield definitions.
- Not every metafield type can be queried in analytics. To confirm that a definition can use the capability, check the
eligiblefield on itscapability. - A metaobject definition can use the capability only if at least one of its fields has an analytics-compatible type.
For more information, refer to the following resources:
Was this page helpful?