Structured Data, Google Search and Your Shopify Store

This tutorial explains what you can do to improve the chances of the Google organic search results for your Shopify store showing rich snippets that include product review data.  

Disclaimers

As Google is always updating their search algorithms, this article may be out of date.  This article was last updated on 30Jan18.

There are multiple factors that determine what structured data your store will output.  You'll need to evaluate each of the following for your site and determine the right solution for your site.

  1. Shopify Theme - each theme can implement structured data differently.
  2. Review App - each review app has its own way of handling structured data.
  3. Other Apps - there are SEO and structured data apps in the Shopify app store.  If your store is using any of these, they can impact your output.

What are Rich Snippets?

Rich snippets are useful pieces of information that Google adds to search results.  Rich snippets can have many different types of content and format.  Here's two common ones that we see with Shopify stores:

Reviews

Price and Availability

Organic search results with snippets contain more information than a standard search result.  Therefore, snippets generally increase the conversion rate of the search result.  This is especially true for reviews as the colored stars really stand out on a search result page.

How Do I Get Rich Snippets?

Google uses the structured data on a site to determine the content for rich snippets for that site's organic search results.  Simply put, structured data is information added to a page that follows documented guidelines.  This information is not seen by the viewer of a page but is used by web crawlers to determine the content of a page.

The Google algorithm decides which search results will get snippets and what they will look like.  And the Google algorithm's logic isn't public and it is always changing.  So you can't be guaranteed that your Search results will include snippets.  But the steps below with the best position your store for it.

Tools

Google provides a great tool for you to use in evaluating the structured data on your Shopify store.  Its aptly called the Google Structured Data Testing Tool and can be found at https://search.google.com/structured-data/testing-tool.  This tool will show you exactly what structured data Google sees on a page and is invaluable in evaluating your site.  What the tool does NOT do is predict if that data will be used by Google and displayed in search results. 

A Little More Background / Best Practices

Your Shopify store should be using JSON-LD format.  Here's why:

Structured data can be provided in a number of different formats.  Two common ones in Shopify are JSON-LD and microdata.  

JSON can be spotted because it is usually contained within a script that would open with:

<script type="application/ld+json">

Microdata is commonly used in themes.  Its usually added throughout the code alongside the HTML code used to present the related element on the screen (in other words, the microdata for the price is usually found in the same line that shows the price on the page).  You'll see it in liquid files with elements like:

itemscope itemtype="http://schema.org/Product
itemprop="sku"
<meta itemprop="priceCurrency" content="{{ shop.currency }}" 

Google treats separate instances of structured data as separate entities.  In other words, if a page has some product structured data in JSON-LD and some different product structured data in microdata, then Google thinks there are two products being referenced on the page.  Which means the two structured data elements are competing against one another for which one gets used by Google.

One benefit of JSON-LD is that two separate data elements on the page can be associated with each other so they don't compete with each other.  (The LD stands for Linked Data.)  The elements are linked by ensuring that they have the exact same @id.  Google also prefers the JSON-LD format.

Making it Work for Products and Reviews in Shopify

So, to make this all work on a product page and increase the likelihood that reviews show in the rich snippets on organic search results, my advice is the following steps:

  1. Use a review app that provides the review data in JSON-LD.  I won't go into more details on the review apps here.  Ask your review app provider what formats they support and what is implemented on your site.  Many review apps can make changes to the structured data on their servers using tools the stores don't have access to, so get in touch with them.
  2. Add product level structured data to the page in JSON-LD.
  3. Ensure that the review JSON and the product JSON above use the same @ID so they are (virtually) combined.
  4. Remove product level micro-data from the theme liquid.

Product Data JSON-LD

Adding product data in JSON-LD format is actually pretty easy.  I create a snippet that I name product-json-ld.liquid.  The contents of this data can vary according to your needs and your products.  Here's an example of product-json-ld.liquid that I use.

Common @ID

So, your review app probably already has an @id that it is creating.  So you can use the same logic to create the @id that you add to the theme liquid.

In the example above, I'm using the fully qualified URL for the product.  Remember that a single product can exist on several different URLs because of collections as illustrated here:

  • https://acme.com/products/widget
  • https://acme.com/collections/best-sellers/products/widget
  • https://acme.com/collections/spaceship-components/products/widget

So this code creates a fully qualified URL to the product page without any collections:

"@id": "{{ shop.url | append: '/products/' | append: product.handle }}",

Removing Microdata

Ideally, one would remove the microdata from the product pages, so it is very clear to Google what structured data to use.  But the FB Pixel uses the microdata, so if you are doing FB advertising (which means just about everyone), you'll need to keep it in there.

That said, if you want to remove the microdata, here's how.

If your theme is using microdata for the products, your product liquid files have the code for it throughout the liquid.  But, you don't need to delete all of the references.  All you need to do is delete the title/header entries that start the listing.

To do this find the following entries in your product template/section/snippet (wherever they are placed in your theme) files and delete them.  Delete just the text below, not the whole line of code.

  • itemscope itemtype="http://schema.org/Product"
  • itemscope itemtype="http://schema.org/Offer"

What Success Looks Like

Success is judged by examining the structured data that the page outputs.  To see the output of a page's structured data, use Google's Structured Data Testing Tool.

The first thing to check in the tool is how many product 'cards' appear in the results.  Here's what you want to see; a single card.  Note that the ID is listed there.

Then next thing is to click on the PREVIEW button and see what data is shown.  In this example, we can see that the review data and the price/availability data, which came from different sources, are both available on the same card which means our common @ID was successful.

Summary

Most people agree that Google search results that include review snippets will improve click through.  But getting them to work takes a little bit of work as the theme, review app and other SEO apps can all impact the structured data that drives their inclusion in Google organic search results.  So it may take some code/setup work between your theme, review app and SEO apps to get things working as desired.



Jade Puma is a certified Shopify Expert. If you need any help with your Shopify store, we can help.


Learn More