Reduced by 1% when order is placed
Hurry up to get the best offer!
Rating 5 stars - 1 votes

Magento 2 structured data markup: schema.org and google tag manager

Structured Data Markup and Magento

Your search result rankings can be considerably optimized by using Magento 2 rich snippets or structured data markup. Rich snippets show some additional information about a product, e.g. it's rating, price, photo, availability etc., that's why they are called rich. Such details displayed in your snippet will make it look well presented and will probably be primarily noticed by users.

How Can I Get Magento 2 Rich Snippets?

In order to make more information displayed in your snippets, you have to add structured data markup to your website.

Structured data is a piece of code of specific format used by search engines to create rich snippets.

Schema.org is considered to be the best alternative for generating rich snippets. This project was developed by most popular web search engines for providing code examples for particular cases.

Below you can find the detailed instructions on how to configure Magento 2 structured data using Schema JSON-LD method along with Google Tag Manager.

Schema.org And Google Tag Manager

In order to successfully implement structured data markup on your site, it is recommended to use Google Tag Manager. This tool can greatly speed up the process of creating rich snippets as it allows creating tags on different pages using the same piece of code. For example, if you want to specify product price in every page snippet, you can create tag 'Price', so the price will be taken from every product page and displayed in its snippet.

Tags will work properly only if you configure triggers. Triggers are the conditions for Google Tag Manager to use this or that tag. So if you do not want to place one and the same tag in each and every snippet, you need to tell Tag Manager when to use specific tags.

Besides, GTM allows creating variables, e.i. separate URLs or page elements like buttons or headings for dynamic generation of structured data. The relation between a tag and a variable is the following: if the variable meets the conditions of a trigger, the tag will be used.

Add JSON-LD Code to Your Magento 2 Using Google Tag Manager

Here are detailed guides on how to add JSON-LD structured data to your site:

  1. If you are not sure if you can create JSON-LD code by yourself, it is possible to generate it using Schema JSON-LD Generation Tool. Just select the necessary properties to be included in the markup and copy it to the clipboard.

  2. magento-2-structured-data-markup-schema
    Magento 2 Structured data Markup

  3. Go to Google Tag Manager and create a custom HTML tag and name it.

  4. magento-2-add-new-variable
    Magento 2 Structured data Markup

  5. Paste the generated code to Custom HTML text box and press 'Save'.

  6. magento-2-schema-custom-html-tag
    Magento 2 Structured data Markup

  7. On the popped-up window, press 'Save tag' button (ignore the message that the trigger is not chosen).

  8. magento-2-add-new-trigger
    Magento 2 Structured data Markup

  9. Add a trigger to the created tag.

  10. magento-2-structured-data-markup-trigger
    Magento 2 Structured data Markup

  11. Select its type (Page View) and specify what pages it should fire on.

  12. magento-2-structured-data-markup-trigger-type
    Magento 2 Structured data Markup

  13. Underneath indicate the conditions on which the tag should work.

  14. magento-2-structured-data-markup-configure-trigger
    Magento 2 Structured data Markup

  15. Open the custom HTML page you've created on step 2 and choose the trigger for the tag (in our case it is Page View).
  16. In case you want to create the same tag for different pages but make it fire on different conditions, you should create variables for this tag:

    • Press 'New' button and name the variable;

    • magento-2-add-new-variable
      Magento 2 Structured data Markup

    • Go to 'Variable' configurations and choose the variable type;

    • magento-2-structured-data-markup-select-variable-type
      Magento 2 Structured data Markup

      If you select Dom Element type, specify the selection method (CSS Selector in our case), Element selector (for example, H1) and Attribute name.

      Magento 2 Structured data Markup

    • Add the generated variable to the custom HTML page.

  17. Press red 'Publish' button to apply the changes.

  18. To check the accuracy and the validity of the produced code, you can use Structured Data Testing Tool. Just enter the URL to the page containing structured data and press 'Run Test' button.

The implementation of structured data markup to your Magento 2 may seem not so easy, although it can make a great contribution to your SEO. By setting up rich snippets with Google Tag Manager you assist Google in the understanding of when and how to show your pages. That's why it can optimize your positions in search results.

Be the first to comment.
Live Chat