How structured data gets onto your site
SEOA lot is written about structured data: what it is, which types exist, what it does in the search results.
6 min read
By Timo Wessels Published
A lot is written about structured data: what it is, which types there are, what it does in the search results. Almost nothing is written about the question after that: by what route does it actually get into your page?
That is no side issue. There are three routes, they differ considerably, and the decision is mostly not made at all. You install a plugin, and the decision has fallen.
The most important points first:
- You can write the statements directly into the page, generate them with a plugin or insert them through a tag manager.
- For a few fixed statements, such as your company’s details, the direct way is mostly best.
- After building it in, check whether a search engine really sees the statements.
What is actually built in
Structured data is a small block of text in the source of your page. It is not visible content but a description of what is on the page: this is a company, this is its address, these are the opening hours. Or: this is an article, this is the author, this is the date. According to Google it describes the content of the page it stands on.
Google supports several formats. It recommends taking the format that is easiest for you to implement and maintain, and in most cases that is JSON-LD. That is a self-contained block that can sit anywhere in the page and does not touch the visible content. Exactly that makes it exchangeable, and that is why there is a choice at all of how it gets there.
Way one: directly in the page
The block is written in where it belongs. Done.
In favour: it is there without detours. No additional program, no additional script, no intermediate step where something can fail. What is in the source is there for anyone who reads the page.
Against: it is manual work, and it repeats. For fifty posts, fifty times. If you change your opening hours, you must know where they are entered.
Sensible for: few, fixed statements that rarely change. The description of the company on the contact page. The details on the home page.
Way two: a plugin
The plugin builds the block from your settings and puts it on every fitting page.
In favour: it scales. Set up once, and every new post gets its markup automatically. It keeps to the rules without your having to know them. When the rules change, which happens regularly, you get an update. The last argument is stronger than it sounds. Statements built in by hand go stale quietly.
Against: it is one more plugin. It runs on every page view, it has to be kept up to date, and it ties you to itself. If you swap it out, the markup is gone, because it lay in its settings and not in your content.
Sensible for: sites with many similar pieces of content, such as a blog, a directory or a catalogue.
Way three: through a tag manager
The most interesting way, and the one least is written about.
A tag manager is a tool with which snippets of code can be inserted into a page without touching the page itself. You enter them in an interface of their own, and they appear on the website. Google describes this way itself: in Google Tag Manager you create a “Custom HTML” tag, paste the block in, publish the container and check the result.
In favour, and this is the real argument: whoever does this needs no access to your website. That is a serious advantage. If you commission someone for it, you do not have to give them administrative access. If someone in the house takes over the task, this person does not have to be able to reach everything else. And all inserted snippets lie in one place.
Google adds a note: in the tag manager use variables that fetch the statements from the page instead of repeating them there. If you repeat them, the risk rises that page and markup drift apart.
Against, and here it gets uncomfortable: a tag manager is an additional program from a third party that runs on every page view. It builds the statements into the page afterwards instead of their being there from the start. Google points out that with product data, generated statements can make the reading for Shopping less frequent and less reliable. And depending on which tag manager it is and what else it does, it becomes something visitors have to be informed about and may have to consent to. That is my objection.
So a way meant to solve an access question can open a consent question. That is a poor trade for a handful of lines that could simply stand in the source.
Sensible for: larger houses with separate responsibilities, where access to the website is really an issue and where such a tool is running anyway.
Not sensible for: a site that would introduce it for this reason alone.
What I recommend for small sites
A mixed way, because the requirements differ:
- The fixed details of the company directly in the page. Name, address, opening hours and ways of contact change rarely and belong in the source without a detour.
- Recurring content through what already runs. Many search engine plugins already bring the markup for posts and pages. Before you install a second plugin, see whether the existing one can do it. Very often it can, and it is just not switched on.
- A tag manager only if it is there anyway. Introducing it for this purpose costs more than it brings.
That is not an especially elegant answer. It has the advantage that it needs no additional program.
How to tell whether it works
The test takes a minute and is independent of the chosen way.
The quick look: open the source of your page with Ctrl+U and search for the word schema. If you find a block, something is there. If you find nothing, either nothing is there, or it is built in afterwards and stands only in the fully assembled page.
The test that counts: Google recommends the Rich Results Test during development and the reports in Search Console after building it in, to see whether the pages stay valid. Enter your address into the test, it shows what is actually recognised. That is the reliable answer, because it looks at the page the way a search engine does.
Here way three shows in practice: statements built in afterwards appear in some checks and not in others, depending on whether the tool assembles the page fully or reads only the delivered source. With ways one and two this question does not arise.
The core
The question is not whether you need structured data. The question is what building it in costs you.
An additional plugin, an additional foreign script, or a few lines written once by hand that then stand on their own: those are three very different answers to a task that has the same result in all three cases. And the third is sufficient more often than it looks.
Sources
- Google Search Central, Intro to how structured data markup works — the block describes the content of the page, several formats, JSON-LD easiest in most cases, test with the Rich Results Test and reports after building it in: developers.google.com(external site: developers.google.com)
- Google Search Central, Generate structured data with JavaScript — generate JSON-LD with Google Tag Manager, variables instead of duplicated statements, product data and less frequent, less reliable Shopping reading: developers.google.com(external site: developers.google.com)
- Own testing practice — the comparison of the three ways, the consent thought on the tag manager, the mixed way for small sites, the look into the source for the word
schema.