Shopify Flow Adds "Get analytics data": Use ShopifyQL to Automate Reports, Alerts, and Product Actions

Table of Contents

  1. Key Highlights
  2. Introduction
  3. How the "Get analytics data" action works inside Flow
  4. Practical use cases that change daily operations
  5. ShopfiyQL basics for Flow: structure, patterns, and sample queries
  6. Building workflows that act on analytics variables
  7. Integrating analytics-driven workflows with other tools
  8. Real-world examples and short case studies
  9. Managing limits and common pitfalls
  10. Best practices for production-grade analytics workflows
  11. Sample workflow blueprints and message templates
  12. Performance considerations and cost implications
  13. Governance and access controls
  14. Troubleshooting and debugging common issues
  15. Where to go next: documentation and community help
  16. FAQ

Key Highlights

  • Shopify Flow's new "Get analytics data" action lets workflows run ShopifyQL queries to pull sales, sessions, and inventory metrics and use the results as variables for downstream actions.
  • Typical applications include scheduled performance reports to Slack, automated product tagging at sales milestones, sales-threshold alerts, and session-change notifications for storefront monitoring.

Introduction

Shopify has extended Flow’s automation capabilities by embedding analytics directly into workflows. The new "Get analytics data" action executes ShopifyQL queries inside Flow, turning query outputs into variables that conditional logic and subsequent actions can consume. That change removes a frequent barrier for merchants and operations teams: the need to extract analytics manually or route data through external tools before responding.

Automation now can react to business signals without human intervention. A merchant can raise an inventory alert the moment a product falls below a re-order level, tag best-sellers automatically, or route a weekly sales snapshot to the right Slack channel. Developers and operations leads can create more nuanced automations because the workflows can pull specific metrics and compare them in real time. The feature delivers immediate practical uses and also raises governance and performance considerations that teams must address when they design production automations.

The following sections explain how the action works, outline practical use cases, provide concrete examples and sample ShopifyQL patterns, and describe limits and best practices you should apply when rolling this into a live store.

How the "Get analytics data" action works inside Flow

The new action embeds ShopifyQL — Shopify’s analytics query language — directly into a Flow workflow. When the action runs, Flow sends the query to Shopify’s analytics engine and returns the results as variables. Those variables can be read by Flow conditions, used to populate messages, or passed to other actions.

Key operational details:

  • Query results are converted into Flow variables. A query that returns a single numeric value (for example, total sales over the last 7 days) becomes a single scalar variable. Results with multiple rows or columns are exposed as structured variables that conditions and loops can iterate over if the workflow supports it.
  • The action executes synchronously in the context of the workflow run. The query result is available to the following steps immediately after the action completes.
  • Queries can pull sales figures, session counts, and inventory-level metrics. The exact field names and available metrics track the analytics schema that Shopify publishes in its Help Center.
  • Workflows can schedule or trigger the "Get analytics data" action. Use scheduled triggers for periodic reports and triggers based on events (product update, order created) to collect targeted analytics on demand.

Because the analytics call happens inside Flow, teams no longer need separate extracts or middleware for many tasks. The integration shortens the path between data and action and reduces manual overhead.

Practical use cases that change daily operations

Embedding analytics into automations unlocks concrete benefits across operations, marketing, and product management. Here are common patterns and what they achieve:

  • Scheduled executive or operations reporting
    • Build a nightly or weekly Flow that queries total sales, average order value, sessions, and low-stock counts. Format the returned values and push them to Slack or email the finance lead. The automation replaces spreadsheets and manual exports for routine cadence reporting.
  • Real-time sales threshold alerts
    • Monitor sales for a campaign or a product line. If sales drop below a predefined threshold in the last 24 hours, send a Slack alert to marketing and the store manager so they can investigate creative, targeting, or fulfillment issues.
  • Automated product tagging and catalog management
    • When a product reaches a sales milestone — for example 100 units sold in 30 days — tag it as a "top-seller". Tagging enables downstream actions such as including the product in promotional collections or triggering merchandising workflows.
  • Inventory and re-order automation
    • Query inventory levels across warehouses and trigger notifications or purchase orders when stock is low. Combine inventory analytics with lead-time data to create smarter reorder rules inside Flow.
  • Traffic and session monitoring
    • Track sessions by source or page and alert when sessions drop significantly after a marketing push, or when conversion rates fall for a landing page. Use the metrics to validate A/B tests automatically and revert campaigns if KPI deterioration is detected.
  • Campaign verification and anomaly detection
    • After launching ads or shipping an email, set a workflow to check whether sessions and conversion metrics moved as expected. If results fall outside expected ranges, the campaign owner receives an automated notification to pause the campaign.

These use cases reflect what operations teams already do manually, now executed continuously and without human intervention.

ShopfiyQL basics for Flow: structure, patterns, and sample queries

ShopifyQL follows SQL-like patterns but targets Shopify’s analytics schema. The new Flow action accepts ShopifyQL scripts that select metrics and filter by date, product, collection, or source. Below are illustrative patterns and sample queries to use as starting points. Validate field names and schema in the Shopify documentation before deploying a query to production.

Core constructs you will use:

  • SELECT for metrics you want returned (revenue, sessions, orders, units_sold, inventory_level)
  • WHERE to filter by date range, product ID, SKU, or other dimensions
  • GROUP BY to aggregate results by day, week, product, or traffic source
  • ORDER BY to sort results for reporting or to return the top N rows
  • LIMIT to reduce result size and control cost

Example patterns (illustrative; field names are representative):

  • Total sales in the last 7 days: SELECT total_sales FROM sales WHERE date >= relative_date("-7d") AND date <= relative_date("-1d")
  • Sales for a product over the last 30 days, grouped by day: SELECT date, total_sales FROM sales WHERE product_id = 123456789 AND date >= relative_date("-30d") GROUP BY date ORDER BY date
  • Sessions by landing page for the previous 24 hours: SELECT page, sessions FROM sessions WHERE date >= relative_date("-1d") GROUP BY page ORDER BY sessions DESC LIMIT 10
  • Inventory level for a product across locations: SELECT location, inventory_level FROM inventory WHERE product_id = 123456789 GROUP BY location
  • Comparison of this week’s sales to last week’s: SELECT period, total_sales FROM sales WHERE period IN (current_week(), previous_week()) GROUP BY period

When designing queries for Flow, minimize result size and complexity. Large cross-joins or wide date ranges could increase runtime and complicate downstream logic.

Tip: Build and test ShopifyQL queries in Shopify’s analytics interface or a test store first, then paste the validated query into Flow. That reduces syntax errors and unexpected variable outcomes inside the workflow.

Building workflows that act on analytics variables

Turning a query result into meaningful action takes three steps: run the query, evaluate the result, and execute the action. Flow’s visual builder maps these steps to the "Get analytics data" action, conditional nodes, and actions like "Send Slack message", "Add product tag", or "Create order" (via integration).

A simple workflow to alert on a sales drop:

  1. Trigger: Schedule (every day at 08:00) or event-based trigger tied to an order or campaign.
  2. Action: Get analytics data — query total sales for yesterday.
  3. Condition: If query_result.total_sales < threshold_value
  4. Action: Send Slack message to #ops channel with details and link to the analytics dashboard.
  5. Optional actions: Tag the campaign as "needs-review", create a task in a ticketing system.

Flow knobs to configure:

  • Variable naming: Name the query result variable clearly (e.g., yesterday_total_sales) so the condition and message templates refer to an understandable label.
  • Thresholds: Use absolute numbers or relative comparisons (drop percentage) to reduce false positives. For example, require both a drop greater than 15% and a revenue decline exceeding $500.
  • Backoff and suppression: Avoid alert storms by adding a cooldown — once an alert is sent, suppress further alerts for a configured period or until a reset condition clears.
  • Fallbacks: Define alternate actions when queries return null or error (e.g., send an error notification to an admin rather than proceeding with empty results).

Example Flow configuration for product milestone tagging:

  • Trigger: Product updated OR scheduled daily run.
  • Action: Get analytics data — query units sold for product_id in last 30 days.
  • Condition: If units_sold >= 100 AND product does not already have "Top Seller" tag
  • Action: Add product tag "Top Seller" and send Slack notification to merchandising

A few implementation notes:

  • Time zone management matters. Shopify analytics interpret dates in the store’s configured timezone; design queries and schedule triggers accordingly.
  • For multi-location stores, include location filtering in inventory queries to avoid misinterpreting total stock across sites.
  • For multi-currency stores, compare metrics in a consistent currency or normalize values before making decisions.

Integrating analytics-driven workflows with other tools

Automation delivers the most value when it connects to the systems teams already use. Flow supports a range of built-in and third-party actions; typical integrations for analytics-driven workflows include Slack, email, Zapier, webhook endpoints, and back-office systems.

Slack

  • Use the "Send Slack message" action to push results into channels. Include metrics and a short interpretation: show percentage change, highlight affected SKUs, or attach a CSV summary for managers.
  • For richer formatting, use Slack’s block kit and include direct links to product pages or reports. Ensure the Slack integration has the right channel permissions.

Email and CSV exports

  • Format query outputs into a table and attach as a CSV to an automated email. That works well for scheduled executive summaries where recipients prefer attachments.

Webhooks and external systems

  • POST query results to an external inventory management or ERP system via webhook. Use a compact JSON payload that includes product identifiers, inventory levels, and timestamps.
  • Include error handling: keep a retry or fallback action if the external endpoint rejects the call.

Ticketing and task systems

  • When a workflow detects a problem — a large traffic drop or fulfillment failure risk — automatically create a ticket in the store’s tracking system with the analytics snapshot attached. Include reproduction steps for investigators: what query returned which values, and when.

E-commerce platform integrations

  • Flow can feed data to other Shopify apps or back-end systems. For example, a reorder automation can call into a purchase-order app when inventory falls below the predicted reorder point.

Best practice: standardize payload formats and naming across integrations to simplify downstream parsing and reporting.

Real-world examples and short case studies

Small fashion retailer: automated top-seller tagging

  • Background: A boutique selling seasonal apparel relied on manual inventory reviews and product tagging. Recognition of high-selling items lagged the merchandising schedule.
  • Implementation: The team created a Flow rule using "Get analytics data" that checks unit sales for each product over the last 30 days. If a product surpasses 100 units sold and lacks the "Top Seller" tag, the workflow adds the tag and notifies the merchandising Slack channel with the product link and recent trend.
  • Outcome: The store reduced time-to-collection inclusion for top sellers from one week to one day. Promotional coordination improved, increasing cross-sell rates for tagged items.

Direct-to-consumer supplement brand: campaign performance guardrail

  • Background: The brand runs high-budget paid campaigns and needed automated verification that campaigns generated sessions and orders within accepted ranges.
  • Implementation: For every campaign start event (triggered by a campaign creation), a Flow schedule runs hourly for the first 24 hours. Queries measure sessions and conversion rate for the landing page. If sessions fall under the baseline or conversion dips below a threshold, an alert is sent and the campaign owner receives a recommendation to pause or audit creative.
  • Outcome: Several underperforming campaigns were paused automatically, avoiding wasted ad spend. The team also learned to adjust landing pages faster based on immediate signals.

Large marketplace: inventory governance across distribution centers

  • Background: Managing inventory across multiple locations required tighter automation to prevent oversells and stockouts.
  • Implementation: A scheduled Flow queries inventory levels by location for critical SKUs every four hours. When combined with lead-time data, the workflow triggers purchase orders through an integrated procurement app for locations trending to stockout in less than five days.
  • Outcome: The marketplace reduced stockouts for fast-moving SKUs by 35% and brought procurement lead times into alignment with actual throughput.

These examples illustrate how different business sizes and models can apply internal analytics to automate decisions previously made by people.

Managing limits and common pitfalls

The integration reduces friction, but teams must account for technical and business limits.

Query size and complexity

  • Large queries against long date ranges or many dimensions can take longer and may result in timeouts. Limit queries to the smallest relevant window and use GROUP BY and LIMIT clauses to reduce result volume.

Rate limits and quotas

  • Shopify enforces API and platform quotas. Aggressively scheduled workflows that run many analytics queries could hit limits. Stagger schedule timings and aggregate queries where possible to reduce calls.

Sampling and metric behavior

  • Some analytics metrics may be sampled or delayed. Sensitive decisions should avoid relying on metrics that reconsolidate later. For example, very recent conversions might update as Shopify processes refunds or multi-channel attributions.

Null or missing results

  • Queries that return no data must be handled gracefully. Add a condition that detects null or unavailable results and sends an explanatory alert rather than proceeding with erroneous assumptions.

Time zone and reporting misalignment

  • Ensure schedules and queries use the intended timezone. When comparing past periods, use relative functions or explicit date bounds to avoid mismatches.

Permissions and governance

  • Only grant Flow admins or trusted staff the ability to create workflows that read analytics. Queries can expose sensitive sales and customer metrics; apply least privilege and audit workflows periodically.

Testing and staging

  • Validate queries and the downstream logic in a test store or with limited-scope runs before enabling broad schedules. Test the edge conditions: zero sales, sudden spikes, and partial data availability.

Audit and observability

  • Keep an audit of what workflows run, who created them, and what actions they perform. Logging helps debug unexpected behavior and supports regulatory or accounting reviews when automations affect financial records.

Monitoring alert fatigue

  • Fine-tune thresholds and add noise suppression to avoid excessive alerts. For instance, require a drop greater than X% for at least two consecutive runs before firing a high-priority alert.

Document every workflow’s purpose, ownership, and scope. That reduces accidental duplication and ensures teams know where analytics-driven automation originates.

Best practices for production-grade analytics workflows

Convert the new capabilities into reliable, maintainable automations by applying standard engineering discipline and domain-specific heuristics.

Design for idempotence

  • Actions triggered by analytics should be safe to run multiple times if needed. For example, condition flows to add a product tag only if it doesn't already exist to avoid repeated writes.

Use an environmental staging strategy

  • Build and test queries in a development or test store. Use a flag to switch flows between test and production modes.

Limit and aggregate queries

  • Combine related metrics into a single query when feasible. An aggregated query reduces the number of analytics calls and simplifies atomic decision making inside the workflow.

Name variables and flows clearly

  • Descriptive names speed diagnosis and maintenance. A variable named last_7d_total_orders is easier to interpret in a message template than query_result_1.

Implement a cadence for review

  • Regularly review active workflows, their owners, and any hard-coded thresholds. Business conditions change and thresholds that made sense six months ago may no longer apply.

Use percentage and absolute thresholds together

  • Absolute thresholds protect against small numeric swings triggering actions in low-volume stores, while percentage thresholds prevent large, but expected, seasonal changes from being ignored.

Record provenance for automated changes

  • When a workflow modifies product tags, inventory notes, or triggers orders, include a log annotation or comment that indicates the change source (e.g., "Changed by Flow: Top-seller tag applied on 2026-05-01 because 30-day sales >= 100").

Graceful error handling and retries

  • If external integration fails (webhook timeout or Slack API throttling), implement retries with exponential backoff. Capture failure reason and escalate to administrators if retries exhaust.

Plan rollback and kill-switches

  • Provide a manual override to stop a workflow quickly if it exhibits unintended behavior. A simple flag or toggle visible to admins enables rapid intervention.

Security and privacy

  • Avoid including PII in Slack messages or external webhooks unless channels are secured and recipients authorized. Prefer product IDs and URLs over customer emails when possible.

Sample workflow blueprints and message templates

Blueprint: Daily executive digest to Slack

  • Trigger: Schedule daily at 07:00 store timezone
  • Action: Get analytics data — query returns total_sales_7d, total_orders_7d, sessions_7d, top_5_products (product_id, units_sold)
  • Condition: Always proceed to reporting
  • Action: Send Slack message to #executive with template: "Daily digest: Revenue (last 7 days): ${total_sales_7d}, Orders: ${total_orders_7d}, Sessions: ${sessions_7d}. Top 5 products: ${top_5_products_list}. [Dashboard link]"

Blueprint: Sales drop alert with suppression

  • Trigger: Schedule hourly
  • Action: Get analytics data — query yesterday_sales and average_sales_last_7_days
  • Condition: If yesterday_sales < average_sales_last_7_days * 0.8 AND yesterday_sales < minimum_sales_threshold
  • Action: Check cooldown tag on store metadata; if no cooldown, send Slack alert and add cooldown metadata for 6 hours

Blueprint: Inventory re-order trigger

  • Trigger: Schedule nightly
  • Action: Get analytics data — inventory levels for critical SKUs, daily sell-through rate for last 14 days
  • Condition: If projected_days_of_stock < reorder_point AND existing_pending_purchase_orders = 0
  • Action: Create PO through procurement integration and notify inventory manager

Each blueprint requires a test plan and owner assignment to be production-ready.

Performance considerations and cost implications

Running analytics queries at scale comes with performance trade-offs. Workflows that poll the analytics engine frequently across large catalogs can increase load and may require throttling.

Reduce computational load:

  • Narrow date ranges and filters.
  • Use GROUP BY to reduce rows returned and transfer only what you need.
  • Cache or persist results in a store metafield if multiple workflows reference the same data within a short window.

Plan for costs:

  • While Flow itself is part of Shopify’s app ecosystem, downstream integrations may incur API or app usage fees. Frequent notifications and calls to third-party services can generate incremental costs.

Estimate impact on existing dashboards:

  • Analytics queries that differ from the metrics the BI team uses can create confusion. Coordinate with analytics owners to avoid duplication and ensure single-source-of-truth metrics.

Scaling patterns:

  • For large stores, schedule high-frequency checks only for a small set of critical SKUs or KPIs, and use lower-frequency sweeps for the remainder. Use event-driven triggers as an alternative to polling where possible.

Governance and access controls

Given the ability to read and act on sensitive analytics, governance matters. Define roles and policies:

  • Approvers: Who can create new workflows that query analytics and perform write actions (tags, orders, POs)?
  • Review cadence: How often will workflows be audited? Include reviews after major calendar events like peak sales seasons.
  • Logging: Keep a log of workflow runs, who created or modified them, and the actions performed.
  • Separation of duties: Restrict financial actions (e.g., auto-creating refunds or large POs) to a small set of trusted users and add a dual-approval mechanism if the platform supports it.

Document retention

  • Store a copy of critical query definitions and output snapshots for a reasonable retention period to support audits and incident investigations.

Troubleshooting and debugging common issues

Patterns and checks to diagnose problems quickly:

No results returned

  • Verify date filters and product IDs. Confirm the analytics schema uses the same identifiers used in the query.
  • Test the query manually in the analytics console.

Unexpected or incomplete values

  • Check if metrics are delayed or subject to sampling. For recent data, allow for processing lag.
  • Confirm time zone alignment between query and store settings.

Workflow errors or timeouts

  • Reduce query scope. If necessary, break a large query into smaller chunks and aggregate results inside the workflow.

Duplicate alerts

  • Add state checks or cooldowns. Ensure your workflow does not re-fire before a condition clears or a human confirms resolution.

Integration failures (Slack, webhooks)

  • Check API credentials and permissions. Confirm rate limits have not been reached.
  • Log the payload and response to diagnose why a call failed.

Permissions denied

  • Ensure the Flow user or API role has appropriate analytics read access. Restrict Flow creation privileges to designated users.

When debugging, capture query text, sample results, workflow run IDs, and timestamps. These items help Shopify support or internal teams reproduce and resolve issues.

Where to go next: documentation and community help

Shopify’s Help Center documents available metrics, query language details, and the Flow "Get analytics data" action’s limitations. Follow the documentation for authoritative schema details and examples. The Shopify community forums host discussions, templates, and user-shared workflows; browsing community threads helps when adapting patterns that solved similar business problems.

Experimentation is useful: start with low-risk automations such as reports and tags before moving to workflows that create financial obligations or alter inventory at scale.

FAQ

Q: What types of metrics can Flow’s "Get analytics data" action retrieve? A: The action can pull sales figures, session counts, inventory-related metrics, and other analytics exposed through ShopifyQL. Exact metric names and available dimensions are defined in Shopify’s analytics schema. Use the Help Center to confirm field names for specific metrics you need.

Q: Can the query results be used directly in conditions and actions? A: Yes. Flow exposes the query results as variables. Scalar results can be compared in conditions; multi-row results can be iterated or summarized before taking actions. Name variables clearly to keep logic understandable.

Q: How often can I run analytics queries in Flow? A: Frequency depends on the schedule you configure and Shopify’s platform quotas. Avoid overly frequent polling across large datasets. Aggregate queries and stagger schedules to reduce load. If you expect heavy usage, coordinate with platform support to understand applicable limits.

Q: Are there constraints on query complexity or time range? A: Complex queries and long time ranges increase execution time and the chance of timeouts. Keep queries focused, use GROUP BY to reduce result size, and test performance before scaling. If you need large historical analytics, consider periodic batch exports rather than frequent real-time queries.

Q: How should I handle alerts to avoid noise? A: Combine absolute and relative thresholds, implement cooldown windows, and require multiple consecutive failing checks before sending high-priority alerts. Include context in alerts so recipients can triage faster.

Q: What permissions are required to create workflows that read analytics? A: Users who create or edit Flow workflows must have appropriate store permissions. Limit Flow creation and analytics access to trusted staff, and audit workflows periodically.

Q: Does the action support exporting query results as CSV or sending attachments? A: Flow can format query results into messages and pass structured payloads to integrations. For attachments like CSVs, use a Flow step that formats data and sends via email or POSTs to an external service that generates the file.

Q: Are ShopifyQL field names identical across stores? A: The schema is consistent, but data availability depends on store configuration (for example, multi-location inventory) and enabled features. Validate queries in a test environment.

Q: What happens if the query fails or returns null? A: Design the workflow to detect null or error responses. Add conditional logic to handle failures: notify an admin, retry, or skip downstream actions to avoid unintended changes.

Q: Where can I get help if I have questions about query syntax or unexpected results? A: Consult Shopify’s Help Center for ShopifyQL documentation and Flow action specifics. Use the Shopify community forums to ask questions and share patterns. If you suspect a platform issue, contact Shopify support with query text and workflow run logs.


The addition of ShopifyQL into Flow brings analytics-driven decisions closer to the operational center of e-commerce businesses. Properly designed, these automations reduce manual work, accelerate responses to business signals, and tighten the feedback loop between metrics and action. Apply the patterns, test carefully, and govern access to keep these automations reliable and aligned with your store’s processes.

POWER your ecommerce with our weekly insights and updates!

Stay aligned on what's happening in the commerce world

Email Address

Handpicked for You

09 May 2026 / Blog

Shopify Flow Adds "Get analytics data": Use ShopifyQL to Automate Reports, Alerts, and Product Actions
Read more Icon arrow

08 May 2026 / Blog

Shopify adds marketing opt-in checkbox to customer account sign-in — what merchants must do now
Read more Icon arrow

07 May 2026 / Blog

Shopify Removes Benchmark Comparison from Analytics — What Merchants Should Do Before May 19, 2026
Read more Icon arrow