Google Tag Manager (GTM) can add schema to a page. You create a Custom HTML tag, paste one JSON-LD script into it, limit it to the right pages, preview it, publish the container and test the live URL. Google documents this route in its guidance on generating structured data with JavaScript.

One condition comes with the method. The tag adds the markup after the page loads, so a crawler may need to render the page before it sees the markup. Where you can change the page's server output, that is the better home for schema.

Key takeaways

  1. GTM can carry JSON-LDA Custom HTML tag can hold one JSON-LD script, and Google documents this route for adding structured data.
  2. Limit the triggerUse a page-view trigger with a URL condition so the markup appears only on the pages it describes.
  3. Markup arrives after loadThe tag adds markup after the page loads, so a crawler may need to render the page before it sees it.
  4. Escape page valuesA quote, line break or backslash in a title can break the JSON, so return a finished JSON string from a variable.
  5. Preview, publish, testConfirm the tag fires once in Preview, publish the container, then test the live URL with Google's tools.
  6. Eligibility is not displayA passing test shows the markup meets a feature's technical checks. It does not guarantee a rich result or a ranking change.

When Google Tag Manager is a good route for schema

Use GTM when you have no access to templates or the CMS, or when you need to manage markup from one central place. Both are practical reasons, and neither makes GTM a poor choice. If your platform already outputs schema through a theme, an SEO plugin or an app, check that output first, because a second block describing the same page can create duplicates.

The markup you add has to describe content that visitors can see on the page. It should match the page's current title, author, dates, products, prices and availability, and it has to use a valid Schema.org type and properties. Google's general structured data guidelines also say that markup generated by script can be processed when it is present in the rendered DOM, and that Google does not guarantee a rich result or a ranking change.

If your site runs on a platform with its own schema settings, the platform guides explain what each one already does. There are separate walkthroughs for WordPress, Shopify, Wix, Squarespace, Webflow and HubSpot. For the wider picture of adding markup by any route, read how to add schema markup.

How Google handles JSON-LD added with JavaScript

Google says it supports JSON-LD injected with JavaScript, including JSON-LD added through GTM, and that structured data present in the DOM during rendering can be processed (Google Search Central, "Generate structured data with JavaScript"). The browser loads the page, GTM runs your tag, the tag inserts the script, and a crawler that renders the page can read it.

That order is the source of the main limitation. Rendering JavaScript can add a delay before a crawler sees the markup. The same Google page notes that Product markup generated by script can make Shopping crawls less frequent and less reliable, especially for price and inventory. For a blog post or a company page whose facts rarely change, the delay matters less. For a product whose price or stock moves often, it matters more.

Google's guidance for the setup itself is short. Install GTM on the site, add a Custom HTML tag, paste a supported structured-data block, publish the container, and test the implementation. It also recommends using GTM variables to collect values from the page, so you are not copying the same facts into a second place by hand.

A woman in a burgundy sweatshirt points a pen at a laptop at a desk in a small bakery back office
Figure 1. Preview the tag on the intended page before the container is published.

Choose the schema type and the properties

Before you open GTM, decide what the page is and which type describes it. A news or blog page usually takes Article, NewsArticle or BlogPosting, and a page with a breadcrumb trail can also take BreadcrumbList. The worked example uses BlogPosting. If you want the property details for a type, the guide to article schema and the guide to breadcrumb schema go through each field.

Keep two kinds of requirement apart. Schema.org defines the vocabulary, the types and properties you may use. Google then lists its own requirements for each search feature it still shows. A property can be valid vocabulary without being required by Google, and a type can be valid without any Google feature behind it.

Google's Article structured data page says there are no required Article properties, and recommends adding the ones that apply, including author, author name, author URL, headline, images and dates. Its breadcrumb page is stricter, and the table below shows the difference.

Properties in the example and what Google says about them

Hover over or tap a row to highlight it. On small screens the table scrolls sideways.

PropertySchema.org vocabularyGoogle feature status
@typeIdentifies the type of the item.Not listed as required: Google lists no required Article properties, but the parser needs it to read the block.
headline, image, datePublished, dateModifiedProperties defined by Schema.org.Recommended for the Google Article feature.
author with name and urlProperties defined by Schema.org.Recommended for the Google Article feature.
publisher, description, mainEntityOfPage, urlProperties defined by Schema.org.Optional for the Google Article feature.
articleSection, inLanguageProperties defined by Schema.org.Optional for the Google Article feature.
BreadcrumbList itemListElementEach ListItem carries position, name and item.Required for Google's breadcrumb feature, with at least two items.

Create the Custom HTML tag, step by step

Work in the GTM workspace for the container that is installed on your site. If you are not sure it is installed, load the live page, open the browser's developer tools and look for the GTM script in the page's HTML before you build anything. Then follow this order.

  1. Confirm the GTM container is installed on the site.
  2. In GTM, open Tags and select New.
  3. Choose Custom HTML as the tag type.
  4. Add one JSON-LD script for the page type, wrapped in <script type="application/ld+json"> tags.
  5. Create variables for values that already exist on the page.
  6. Add a page-view trigger limited to the correct URL pattern or template.
  7. Save the tag.
  8. Use GTM Preview and Tag Assistant to confirm the tag fires once.
  9. Publish the container.
  10. Test the live URL with Google's Rich Results Test and URL Inspection.

Google Tag Manager's help page on custom tags says Custom HTML needs its JavaScript placed inside script tags, and that GTM variables use double braces such as {{Page URL}}. The trigger deserves the most care, because it controls where the markup appears. Use a page-view trigger with a condition on the URL, for example a path that matches only your blog posts, so the tag does not describe the wrong pages.

Setup steps from container to live test

  1. Confirm the containerCheck that Google Tag Manager is installed on the site before you build anything.
  2. Create the tagAdd a Custom HTML tag with one JSON-LD script for the page type, wrapped in script tags.
  3. Add variables and triggerUse variables for values already on the page, and a page-view trigger limited to the right URL pattern.
  4. Preview and inspectUse GTM Preview and Tag Assistant to confirm the tag fires once, then inspect the rendered DOM for one block.
  5. PublishPublish the container. The markup is added after load, so server-rendered markup may be preferable where available.
  6. Test the live URLRun the Rich Results Test and URL Inspection on the published page, and validate the payload.

Use variables without breaking the JSON

Variables let the tag read facts that already exist on the page. GTM's built-in Page URL variable suits the url and mainEntityOfPage values, and Page Title can supply a simple title. For anything more structured, GTM's user-defined variable types include a Data Layer Variable for structured page data, a DOM Element Variable for a value that is visible in the HTML, and a Custom JavaScript Variable for a value that has to be calculated.

A Custom JavaScript Variable that returns the page title looks like this:

javascript
function() {
  return document.title;
}

To use it, create the variable in GTM, name it something clear such as "Page headline", and put {{Page headline}} where the headline value belongs in your script. Google recommends collecting the page's information with variables instead of copying the facts into GTM, because that lowers the risk that the visible page and the JSON-LD drift apart.

Escaping is the one technical trap. A quote, a line break or a backslash inside a title or description can break the JSON, so for values taken from the page, return a finished JSON string from a Custom JavaScript Variable or read from a structured Data Layer object, rather than pasting raw text between quotation marks.

A complete BlogPosting script to adapt

This is a fictional example for a page at example.com. Every URL, name and date is a placeholder, so replace each one with information that is visibly present on your real page. The markup uses the Schema.org BlogPosting type, which defines properties such as headline, author, datePublished, dateModified, image, mainEntityOfPage and publisher.

Paste the whole block into the Custom HTML tag, including the script tags. Change the @id and url to the real address of the page, and keep datePublished and dateModified in the format shown, with your own time zone offset. The author here is an organization; if a named person wrote the page, describe that person instead.

html
<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type": "BlogPosting",
  "@id": "https://example.com/blog/adding-schema-with-gtm/#article",
  "url": "https://example.com/blog/adding-schema-with-gtm/",
  "mainEntityOfPage": {
    "@type": "WebPage",
    "@id": "https://example.com/blog/adding-schema-with-gtm/"
  },
  "headline": "Adding Schema With Google Tag Manager",
  "description": "A practical guide to adding JSON-LD structured data through Google Tag Manager.",
  "image": [
    "https://example.com/images/schema-with-gtm-1200x675.jpg"
  ],
  "datePublished": "2026-10-01T09:00:00-05:00",
  "dateModified": "2026-10-15T11:30:00-05:00",
  "author": {
    "@type": "Organization",
    "name": "Example Publishing",
    "url": "https://example.com/about/"
  },
  "publisher": {
    "@type": "Organization",
    "name": "Example Publishing",
    "url": "https://example.com/",
    "logo": {
      "@type": "ImageObject",
      "url": "https://example.com/images/example-publishing-logo.png"
    }
  },
  "articleSection": "Platforms",
  "inLanguage": "en-US"
}
</script>

The example suits a blog article and makes no promise about how the page will appear in search. If you would rather start from a form than from a block of code, the article schema generator builds the same kind of payload. You still replace the values and test the published page.

For more patterns to copy from, see the JSON-LD schema examples.

Add a BreadcrumbList in a second tag

A breadcrumb trail is a separate entity, so give it its own Custom HTML tag with its own script wrapper, and use the same trigger. Keeping one JSON-LD block per tag makes each piece of markup easier to preview and to turn off on its own. The block below is the content of that second script, shown without the wrapper so it stays valid JSON.

json
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "@id": "https://example.com/blog/adding-schema-with-gtm/#breadcrumb",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Blog",
      "item": "https://example.com/blog/"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Adding Schema With Google Tag Manager",
      "item": "https://example.com/blog/adding-schema-with-gtm/"
    }
  ]
}

For Google's breadcrumb feature, itemListElement is required, and each ListItem needs position and name. The item URL is required except on the last crumb, where Google can use the current page URL. You need at least two items, and the path should be a normal route a visitor would take, not simply a copy of the URL structure.

Test before and after publishing

Start in GTM Preview. Load the intended URL, open Tag Assistant and confirm the tag fires once. Then open the browser's developer tools, find the rendered DOM, and confirm there is one valid JSON-LD block on the page, not zero and not two.

After you publish the container, run the live URL through Google's Rich Results Test, and open URL Inspection in Search Console to view the rendered page. Google says that if the Rich Results Test does not support a structured-data type, you should inspect the rendered HTML instead. The Schema Markup Validator checks the payload against the vocabulary, and the Schema Nova checker reads markup from a page you paste in or a URL you enter. The guide on replacing the old structured data testing tool explains which check answers which question.

Be clear about what a passing result means. Google says the Rich Results Test and URL Inspection catch most technical errors but cannot guarantee display. A pass shows that the tested page contains markup meeting the tool's technical checks for that feature. It does not show that Google will display a rich result or that rankings will change. After deployment, watch the relevant rich-result report in Search Console.

A plain page card, then a tag icon dropping a bracket-shaped data panel onto it, then a magnifier waiting over the finished page card
Figure 2. The tag adds the markup after the page loads, so a crawler may need to render the page first.

Fix the common failures

The tag fires on the wrong pages, more than once, or not at all. Reopen the trigger, check its URL condition against the page's real path, and use Preview to see which tags fire on each load. A tag that fires twice usually means two triggers are attached, or a second tag carries the same script.

The markup describes old facts. A tag you maintain by hand will keep describing last month's title, price, author or date until someone edits it. Pull values from the page through variables where you can, and review the tag whenever the page template changes.

The tag never runs. A consent configuration or a tag restriction in GTM can stop a tag from firing. Check how your consent tool treats Custom HTML tags, and read the tag's firing status in Preview.

Two sources publish the same item. A CMS, an SEO plugin and GTM may each output the same entity. Look at the rendered page source for repeated Article or Organization blocks and keep one. Finally, remember that Schema.org may support a type that Google does not currently use for a rich result, so a valid block is not a promise of a special display.

Bing reads JSON-LD too, so the same tag serves both, and Bing says markup must accurately reflect visible content (Bing Webmaster Tools). Check the published page in Bing's URL Inspection tool and its Markup Validator. Yandex offers a Structured Data Validator for the same job. Because GTM adds the markup after the page loads, confirm in each tool that the rendered markup is detected.

To let ChatGPT search reach the page, allow OAI-SearchBot in robots.txt (OpenAI crawler overview). Keep Bing crawling open too, since web-enabled Copilot can use Bing results (Microsoft Learn). For Perplexity and DuckDuckGo, keep the visible page content clear and accurate. See whether AI systems use schema markup for the full comparison.

When server-rendered markup is the better choice

GTM is a deployment method, not a better kind of schema. If you or a developer can add the JSON-LD to the page template, the markup is part of the HTML the server sends, so it does not wait for a script to run. That is the stronger choice for markup that changes often, especially product prices and availability, and Google's note about Shopping crawls, described above, points the same way.

A sensible pattern for many teams is to start with GTM while template access is unavailable, then move the markup into the template once it can be edited, and remove the GTM tag at that point so the page does not carry two copies. Developers working on a Next.js or React site can read the guide to JSON-LD in Next.js and React.

Questions people ask

Can I add Product schema through GTM?

You can, but it is the case Google flags most. Product markup generated by script can make Shopping crawls less frequent and less reliable, especially for price and inventory. If prices or stock change often, put the markup in the server output, and see the guide to product schema markup for the properties.

Why does the Rich Results Test not detect my GTM schema?

Start with the basics. Confirm the tag published, fires on that exact URL and is not blocked by a consent setting. If the type is not supported by the Rich Results Test, Google suggests inspecting the rendered HTML in URL Inspection instead.

Is FAQPage schema still useful for Google?

FAQPage remains a valid Schema.org type, but Google's documentation updates list its FAQ rich result as no longer shown in Google Search as of May 7, 2026. Do not add it in the hope of that display. The FAQ schema guide covers what the type still does.

Does valid schema guarantee a rich result?

No. Google says structured data makes a page eligible for a feature but does not guarantee display. The same is true of Bing's rich snippets and of Yandex snippets, each according to its own documentation.

Does GTM schema work for Bing and Yandex?

Both providers document Schema.org support, and Bing and Yandex each offer their own validator. Whether a given engine renders JavaScript before reading the page is something to confirm in that provider's documentation and tools, so test with Bing Webmaster Tools and the Yandex validator rather than assuming.

Quick check

Choose an answer to see feedback. Nothing is scored or saved.

Question 1 of 3

A Rich Results Test shows that a GTM-injected Article is eligible. What does that show?

Question 2 of 3

Which GTM tag type holds a JSON-LD script?

Question 3 of 3

A page title contains a quote mark. What is the safer way to use it in JSON-LD through GTM?

Terms used in this setup

Select a term to see its definition.

Structured data. Machine-readable information that describes the content of a page.