Is there a supported way to detect that the current user lacks ShopifyQL access when using the analytics web components?

We use s-shopifyql-metric-card in an embedded app. The app has read_reports, protected customer data, and Direct API access. When the logged-in staff member does not have access to ShopifyQL, the card renders Shopify’s own “Couldn’t load data” state.

We want to show our own empty state in that case. I can’t find a documented property, event, or error callback on the analytics web components that says the current user is not allowed to run ShopifyQL.

Is there a supported signal for that?

If there isn’t, is it supported to detect it ourselves by running a small shopifyqlQuery from the embedded app through App Bridge, and treating an access error on that query as “this user can’t use ShopifyQL”? We have not tried that yet. I want to know if it is a supported approach before we rely on it.

Best,

Pius

Hi @Pius_Osuji

There isn’t a documented permission property or error callback on s-shopifyql-metric-card. Its only documented event is reportlinkclick.

Calling shopifyqlQuery through App Bridge Direct API access is supported, and the analytics components use that same endpoint. You could use a query’s response to decide whether to show the card or your fallback. That would be your app’s access check, though, rather than a dedicated ShopifyQL permission-detection feature.

Two details matter for that approach:

For your fallback, the distinction would be “this query isn’t accessible in the current app/user context.” Handle query errors, expired authentication, and temporary failures separately so they aren’t presented as permission problems.

Thanks for the clarification!