- Google Tag Manager
- Server Side Rendering
Google Tag Manager (GTM)
Google lists six steps for generating structured data dynamically with GTM:
- “Set up and install Google Tag Manager on your site.
- Add a new Custom HTML tag to the container.
- Paste the desired structured data block into the tag content.
- Install the container as shown in the Install Google Tag Manager section of your container’s admin menu.
- To add the tag to your website, publish your container in the Google Tag Manager interface.
- Test your implementation.”
- Find the type of structured data you are interested in.
- Test With the Rich Results Test
The Google documentation only says to test it with the Rich Results Test probably because it does two things at once:
- Tests for eligibility for rich results
- Checks if the structured data validates
Google also has the Structured Data Testing Tool that tests if the structured data is valid but doesn’t give feedback about rich results.
The Rich Results testing tool does double duty by showing warnings and errors in addition to showing if the structured data is eligible for rich results.
There are two ways to test structured data in Google’s Rich Results Test. The first way is by entering a URL so that Google crawls the page and extracts the structured data and tests it.
The second way is to input the code directly.
Google recommends using the URL input and advises to not use the code input.
Read Google’s new documentation here: