| |

The Best Format for Implementing Schema Markup: Google Tag Manager vs. Hardcoded?

Reviewed & Updated by Dylan Jones, SEO Team Lead

When implementing schema markup — a key tool for improving visibility in search through rich results — you generally have two options: hardcoding it directly into your website’s HTML, or deploying it dynamically using a tool like Google Tag Manager (GTM).

Neither option is “wrong,” per se. Both have their merits, but choosing the best method for your online ranking depends heavily on your technical resources, goals, and the scale of your implementation.

Let’s unpack the pros and cons of each method for adding schema as well as demonstrate some examples. In the end, you can decide which process of embedding structured data is best for your SEO strategy.

Let Greenlane help you with your website’s Schema and Technical SEO.

Why Even Care About Adding Schema to Your Site

Schema is a structured data vocabulary that helps search engines understand the content of your site and rank it on search engines like Google and Bing. Need we say more? It can help you improve visibility through rich results and CTR by standing out on the SERP. Period.

Think of schema as “a note card we give Google” to translate human-readable content into a machine/crawler-readable format. It exists entirely in the back end — never seen by users — and it fuels over 30 types of rich results, from product listings to recipe snippets. 

schema markup SERP search

TLDR: Implementing or adding schema helps search engines properly rank your pages online and can increase click-through rates by up to 40-50%, according to industry studies. 

That’s why knowing the best way to add it to your site can help boost your SEO…

Schema Implementation Option 1: Hardcoded

Hardcoded schema markup refers to embedding structured data directly into the HTML of a webpage, typically in the <head> or right before the closing </body> tag. 

The markup is written in JSON-LD (JavaScript Object Notation for Linked Data), which is Google’s preferred format; however, it can also be expressed in RDFa or Microdata inline with the HTML. Because it resides within the page source itself, this method provides search engines with immediate access to the data, eliminating the need for JavaScript execution. 

It’s ideal for delivering consistent, reliable schema, especially on high-priority pages like products, reviews, services, or local business listings, as just a few examples. Also, compared to other methods where your schema lives in another tool (such as Tag Manager), it’s the fastest way for search engines to read your website data without negatively impacting page speed metrics.

An Example of Hardcoded Schema

Below is our SEO Service page under the Inspect tool. Here, you’ll see we have hardcoded WebPage schema before the <head> in the HTML to immediately tell search engines this is a webpage. 

example of hardcoded schema on Greenlane Marketing site

Here’s another example of hardcoded schema on one of our favorite pet brands:

example of hardcoded schema on Great Pet Care site

Other organizations like The American Medical Association have hardcoded schema nested right above their <head> as well:

example of hardcoded schema on American Medical Association site

How to Implement Hardcoded Schema Markup

To implement hardcoded schema, you’ll manually create JSON-LD markup based on the content of each page using schema.org vocabulary. For example, if you’re adding Product schema, your markup might include the product name, description, SKU, brand, and aggregate rating. There are tools out there to help you generate this, such as Schema Markup Generator or Structured Data Markup Helper.

Once written, the markup is added directly to the page template or individual HTML files, typically via a CMS or through a dev team deployment. 

Benefits of Hardcoding Schema in the HTML

  1. Full Control
    With schema embedded directly into your site’s HTML, you control exactly what data is being delivered to Google, and when.
  2. Fewer Dependencies
    No need to rely on third-party tools, which reduces potential points of failure.
  3. Reliable for Critical Pages
    Hardcoding is ideal for high-priority pages where precision and permanence matter, like a Home Page or Location Pages.

Considerations When Hardcoding Schema in the HTML

  1. Developer-Dependent
    Requires dev team support, which may slow down iteration cycles, especially if you’re managing hundreds of pages.
  2. Scaling Is Harder
    Making updates across large sets of pages can be time-consuming and error-prone unless you have dynamic templating in place.
  3. Higher Opportunity Cost
    You may be forced to prioritize only the most valuable pages, which means some schema opportunities get left on the table.

Schema Implementation Option 2: Google Tag Manager (GTM)

Using Google Tag Manager for schema means dynamically injecting structured data into your webpages through GTM tags. This approach doesn’t require code changes to the website itself, making it an appealing choice for marketers and SEO teams who want to move fast without waiting on dev cycles. 

The schema is still written in JSON-LD format, but instead of living in the HTML source, it’s delivered through a JavaScript container that loads when the page renders. This means it’s more dependent on proper rendering by search engines — but for most well-structured pages, GTM-based schema can be crawled and understood just fine.

An Example of Schema Injected Using GTM

In the example below, we show WebPage schema injected via Google Tag Manager on our website.

Example of Schema Injected Using GTM

It’s best to base your trigger on URL structure, page type, or even custom data layer variables if needed. One of the best use cases our team at Greenlane is using GTM to “place manually built schema at scale” for things like WebPage or Product across multiple similar pages. 

How to Implement Schema Markup Using Tag Manager

To implement schema via GTM, you’ll start by creating a custom HTML tag in your GTM workspace. Paste your JSON-LD markup into the tag editor, then configure a trigger to determine when and where the schema should fire (e.g. only on product pages, or when the URL contains /locations/). 

After publishing the container, always test your implementation with Google’s Tag Assistant and Rich Results Test to confirm your schema is being rendered and picked up correctly.

Testing is crucial — use tools like Google’s Rich Results Test and Schema Markup Validator to ensure your code is error-free and aligns with Google’s structured data guidelines.

Schema is best when you have dev resources available and are focusing on mission-critical schema types that should be seen and trusted by Google.

Benefits of Using GTM for Schema Markup Management

  1. Scalable Deployment
    GTM allows you to push schema to many pages with a single tag. During our Lunch & Learn, we highlighted how GTM can be used to “place manually built schema at scale.”
  2. Fast Iteration
    No need to wait for dev deployments — you can update schema directly through the GTM interface, enabling more agile testing and adjustments.
  3. Great for Testing & Learning
    GTM is perfect for proving out the value of schema on a site before committing dev resources. It allows you to test various markup types and see what Google picks up.

Considerations When Using GTM for Schema Markup Management

  1. Less Transparent to Crawlers
    Schema delivered via GTM may not always be reliably crawled and indexed, especially if Googlebot struggles to render the JS. While it often works, it’s not as bulletproof as hardcoded markup.
  2. Debugging Can Be Tougher
    Since the schema is dependent on render timing, it may not be visible in the raw HTML source, which makes diagnosing issues more complex.
  3. Increased Complexity
    Requires a deep understanding of both schema syntax and Tag Manager mechanics to get it right. Misconfigured tags can fire incorrectly, or not at all.

Bonus Option: WordPress Plugins (e.g., Yoast, Rank Math)

Schema plugins for WordPress automatically generate and inject structured data into your site’s pages based on the type of content (e.g., blog post, product, service, local business). These plugins often include schema defaults (like WebPage, Organization, Article, etc.) and let you customize or extend them via the WordPress admin panel. 

For example, Yoast SEO adds basic schema to pages automatically and allows you to define things like the content type and the organization behind the site. Rank Math and Schema Pro offer even more flexibility, including support for WooCommerce and advanced custom fields.

An Example of Schema Injection via Yoast

Below is a screenshot of us using the Inspect tool on our own website to show you in red text the schema “code” on the backend. On the left side, you’ll see the visible mobile version of the Greenlane Marketing website, while Google and other crawlers see the large block of text on the right.

Example of Schema Injection via Yoast on Greenlane Site

We have several types of schema injected into the HTML of our website via the WordPress plugin called Yoast. One common but important example is the use of the Corporation “entity” schema we have. We’ve force-fed links to all our social media outlets to search engines with the use of the “sameAs” code shown below. This markup helps search engines understand associations between our brand site and other outlets we manage to connect our online footprint. 

Example of Schema Injection via Yoast 2

An Example of Schema Injection via Shopify

As another example, we love drinking coffee at Greenlane. One of our favorite roasters is La Colombe. They use Shopify as their CRM and use one of its plug-ins to add schema markup to their site:

Example of Schema Injection via Shopify on La Colombe site

When to Use Plugins for Schema

Plugins are great for quick wins and for non-technical teams that want to add essential schema types, such as Organization, Article, or BreadcrumbList, without touching code. They’re especially effective on small to medium-sized WordPress sites where custom needs are limited. 

However, they become less ideal when:

  • You need to define complex relationships (like hasPart, sameAs, or deeply nested entities)
  • You’re working on non-WordPress platforms
  • You’re trying to minimize unnecessary or bloated code output

As I shared in my presentation to our team on the topic, “Yoast is going to be the most common plugin used. It places some of the higher-level, broad schemas like Organization, WebPage, Product. It’s not always the best, but it’s quick and simple.” It gets the job done, but if you need precision or want to go beyond the basics, you’ll need to supplement it with GTM or hardcoding.

So… Which Should You Use?

While these recommendations are by no means rigid, here’s some high-level advice for using schema.

For Smaller Sites or Critical Pages:

Go hardcoded. You’ll get better reliability and long-term consistency. As noted in the session, schema that’s “testable, validate-able, and trusted” should be a priority — and hardcoding achieves that.

For Large Sites or Agile Testing:

Use GTM, especially if dev bandwidth is limited. You’ll gain the ability to experiment with markup types like Product, Event, or LocalBusiness quickly and see what drives results.

Hybrid Approach:

In reality, the best schema strategies often involve a combination of both. Use GTM to test and learn. Once proven, shift critical schema to hardcoded templates for long-term reliability.

MethodProsCons
Plugins– Easy, no-code setup
– Good for basic/common schema types
– Auto-generates markup
– Limited flexibility
– May not handle complex/nested schema well
– Can bloat markup
Hardcoding– Full control over what and where the schema appears
– Best for precision
– Developer-dependent
– Hard to scale across large sites
GTM– Scalable and fast to iterate
– No site changes required
– Can delay execution
– Harder to debug 
– May not be fully indexed by crawlers

Schema Implementation Support with Greenlane 

Schema isn’t just about rich results. It’s also a foundational building block for Google’s Knowledge Graph and increasingly, for AI systems that rely on structured understanding. Whether you hardcode or use GTM, the goal is the same: help Google (and other platforms) understand the “things” on your site, not just the strings.

So don’t let implementation hurdles stop you from getting started. Choose the path that best fits your team, test often, validate rigorously, and start unlocking the real value of structured data.

Need help implementing your schema? Explore our Technical SEO Services and contact our team at Greenlane, today.

Similar Posts