ShopifyQL: A New Data Querying Language For Shopify Merchants

Ellie Bradford
Jun 7, 2024
3 min read

A good eCommerce business can not exist without data. The facts and figures behind your Shopify store can reveal what it means for success. They can guide your stock purchasing decisions and help you build marketing campaigns that really work. However, digging deep into eCommerce data can be quite complex, often requiring the hand of a trained professional.

Fortunately, this no longer has to be the case. With ShopifyQL, Shopify Plus merchants can easily make data-informed decisions all on their own. In this article, we’ll tell you all about ShopifyQL and how you can leverage it for your store.

The Challenges of Data Query for eCommerce Stores

challenges of data querying in ecommerce

For the average Shopify merchant, extracting detailed eCommerce data is no easy task. Whilst the standard Shopify reports and dashboard can help you monitor key metrics, we bet that there are times when you’ll want to dive deeper. In the past, there wasn't a simple way to do this on Shopify unless you were pretty well-versed in code.

All of your eCommerce data lives in a database. This is where you need to reach to get the additional data. Asking the database for specific information is known as a query.

However, it’s not as simple as typing in a question in plain English. These databases speak a complex language. If you’re not a trained data scientist or hold expertise in coding, it can be hard to wrap your head around. Therefore, merchants usually rely on trained professionals (or an app) to gather vital data which can present some problems.

For one, if you do have a data team to handle queries across the business, you may find yourselves competing for their attention and your data. This can lead to long turn-around times. When it takes too long, chances are that you're forced into making decisions without factual backing. In certain cases, some parts of the business will be prioritized over others, leaving other teams data-less.

Another issue is that hiring a data team is an additional expense that not every business can afford. Merchants in this situation have no choice but to rely on the standard metrics and go off of gut instinct for business decisions.

Shopify noticed the precarious situations their merchants were left in. So, to level the playing field, ShopifyQL was created.

ShopifyQL: An easier and more commerce-centric approach to data query

ShopifyQL is an upgraded data querying language (QL) that can be used to talk to the database of your Shopify store. What sets it apart from other QLs is its simplicity and commerce-centric approach.

With ShopifyQL, Shopify Plus merchants can effortlessly:

  • explore their data using an easy-to-learn syntax
  • visualize data in one step
  • use built-in period comparisons
  • quickly view data from popular dates in the eCommerce calendar like BFCM.

What's more, data from every aspect of your business (sales, marketing, fulfillment, finance, and merchandising) will be centralized. Bringing this together makes it easier to gather insights for all parts of your business.

Discover other conversion boosting tools made by Shopify:


How Can I Use ShopifyQL To Power Data-driven Decision Making?

You can unlock all your eCommerce data in this new and intuitive way through the ShopifyQL Notebooks app (now available for Shopify Plus merchants only). ShopifyQL Notebooks uses ShopifyQL to help merchants explore, visualize, and analyze all of their store’s data. You’ll find this first-party app in the Apps section of your admin page.

Using built-in templates in ShopifyQL Notebooks

shopifyql notebook dashboard

Getting started with exploring your store data is simple. As soon as you enter the app, you’ll find a selection of pre-built templates based on popular eCommerce reports. This includes top-selling products/variants, orders over time, and sales over time. You can use these as a basis for your insights or make minor edits using the ShopifyQL syntax.

query templates in ShopifyQL notebook

The keywords on the left indicate the details you’re requesting. By editing these, you can customize the data you’re retrieving. Let’s quickly break down what each keyword represents in the Sales over time template.

  • From is the dataset you want to retrieve information from
  • Visualize represents the specific data you want to get from the dataset
  • Type is the style in which you want the data to be shown, for example, in a line or bar chart
  • Over is the time dimension
  • Since is the length of timeUntil specifies the final date you want your data to span to
  • Order By represents the column you want the data to be arranged by, for example, day or product_title

So, using the above example, if you want to see your sales over the last year, simply change the value in the Since line to 1y.

Creating your own query in ShopifyQL Notebooks

To really take advantage of ShopifyQL in a way that will boost impactful decision-making, try your hand at creating your own report. As the syntax of the language is much more simplified, pulling all sorts of eCommerce data is a breeze.

To start building your query, you need to use keywords. In total there are 9 keywords that command queries, but you don’t have to use them all. In fact, you can build a query from just 2 keywords; From and Show. Show, in this case, represents the specific data you want from the overall dataset.

auto suggest syntax based on keywords on ShopifyQL

You also get a helping hand as you enter your query. The tool automatically suggests parameters for you as you type. This means you’ll never be out of sync with the ShopifyQL language and can enter your queries quicker. Moreover, it can act as a great source of inspiration for data querying.

When writing your query you can do it all in one line or over several lines. We recommend entering each keyword and its value on separate lines.

Start by entering FROM and then the dataset you want to grab insights from in the first line. This can be sales, products, customers, etc. The next line should read SHOW followed by the particular data you want to see from the overall dataset. It can be one or many.

sample ShopifyQL syntax

If you want to chart your data, change the SHOW keyword to VISUALIZE. Underneath that, use the keyword TYPE to specify the kind of chart you’d like. It can only be a bar chart or a line chart.

syntax to visualize data on shopifyQL

Decide on how you want to segment the data for the GROUP BY line. This can be by any dimension like billing country or month. It’s important to note that if you’re segmenting with a time dimension, any inactive periods of time will not be shown. For instance, if you’re querying monthly sales data, months with no sales will not be included.

To have a continuous stream of data regardless of inactivity, just add the word ALL after the time dimension. You’ll then need to specify SINCE and UNTIL on separate lines.

syntax for time dimension on shopifyQL

The WHERE keyword acts as a sort of filter. It allows you to narrow down your results based on specific conditions with dimensions and comparison operators. For example, you can use it to see sales of a particular product with this parameter product_title = 'track pants'.

comparison operators in shopifyQL querying language

AND, OR, and NOT can be used to expand upon the filtering of your data on the WHERE keyword line.

sample syntax on shopifyQL data querying

Finally, decide on what you want your data ordered by, and use LIMIT if you want to restrict the number of results returned. You’ll want to do this if you're requesting the top 10 best-selling products, for example.

Fiddling with code, no matter how simplified, can be somewhat intimidating. Fortunately, Shopify has created this tool so you can get some practice in using ShopifyQL before you give it a real go. You can also find out more about using ShopifyQL via this workshop by Shopify Unite.

Shopify is currently working on updates that will allow you to easily produce period comparisons, and filter the data by commerce-specific dates like BFCM and Christmas. They’re set to be released late this year so keep your eyes peeled!

Presenting your data

To enable you to add some context to the data ShopifyQL Notebooks lets you add custom text blocks. This is particularly useful should you need to share the data within your business, or jot down insights and make interpretations. The text blocks are fully customizable, and you can even add images such as your company logo or related iconography.

Wrapping Up

ShopifyQL truly empowers Shopify Plus merchants to take the driving seat when it comes to analytics. Thanks to this simplified approach to exploring and visualizing data, gaining meaningful insights and complex data have become so much easier. Merchants no longer have to rely on data experts or gut instincts. Instead, impactful decisions can be made that will really make your business flourish.

The Shopify team is continuously making updates to ShopifyQL. So, data insights will become even more intuitive and focused on the needs of Shopify merchants. This tool is completely free for Shopify Plus merchants, so waste no time and start making data-backed decisions today.

Ellie Bradford
In-Product Marketing Lead
June 17, 2024
7 min read