How to Add Local Schema to WordPress With Google Tag Manager
Local schema is one of the newest and most powerful ways in which to optimize your site for SEO. In order to add local schema markup to WordPress using Google Tag Manager, you first generate the schema, validate the schema, and then install the schema on your website. In this article we’ll go over exactly how to do this, step by step.
What is Schema Markup?
Schema markup is a series of specific code that provides context and specific language to help search engines better understand your content. It is structured in a way to communicate to search engines specific data and facts about your website and/or company. Adding schema markup to your site can help more people find you when searching for sites like yours.
What is Local Schema?
Local schema is a type of schema markup that prioritizes details about businesses that have a physical location by including details like your company’s address, phone number, and hours of operation. It gives a search engine the information it needs to potentially add your site to map results and rich snippets. There are many different types of schema, useful for different types of sites and companies. Local Schema is specifically formatted for brick-and-mortar locations.
If you want to learn more, check out our post about local schema and if it’s right for your business.
What Tools Do You Need to Add Local Schema Markup?
To add local schema markup, you can use a few free tools:
- your WordPress website
- a Microdata Generator
- a Validator
- Google Tag Manager
You don’t need to be a pro developer to add local schema markup to your website. If you have a Google account and a WordPress website, you can install this markup for free yourself.
If you want to learn more about schema markup, we highly recommend you review the Schema website.
How Do You Add Local Schema Markup with Google Tag Manager?
The steps for adding local schema markup with Google Tag Manager are the following:
- Use Microdata Generator to generate the schema.
- Use Validator to validate the schema.
- Set up Google Tag Manager using your Google Account
- Connect Google Tag Manager to your WordPress website
- Create a new tag and trigger in Google Tag Manager
- Test your schema markup again
Note: We will be working through multiple different websites – Google Tag Manager, WordPress, Data Generator, etc. We will be going back and forth between them, so be sure not to close any of these screens until we’re done. Use tabs or new browser windows to switch between them.
Step 1: Generate the schema
First, you need to generate the code itself. The amazing thing about schema markup is that you don’t need to actually write any code. There are tools that allow you to insert your data. Then they generate the code snippet for you.
Go to a generator like this one by Micro Data Generator. Fill out the form with all the necessary information about your business, company, or website.

As you enter the details, you’ll find that the text box below the form begins to generate scope. This is the snippet you will need for the rest of the steps.

Step 2: Validate the Schema
It’s important to make sure that the schema was generated correctly. Use the Validator tool to check.
When you arrive at the site, you will be prompted to select “Fetch URL” or “Code Snippet.” Choose “Code Snippet.”

Copy the code snippet from the previous step, then paste it into this text area. Select “Run Test.”
On the following page, you’ll see the markup listed on the left and the analysis on the right. It will let you know if there are any errors or warnings on this screen. If there are none, move on to the next step. If there are errors or warnings, you may need to reach out to a developer for help.

Step 3: Set up Google Tag Manager
Now, go to Google Tag Manager. (You will need a Google account to use this. If you don’t have one, you’ll need to create a free one first.)
Here is how to set up the relationship between Google Tag Manager and WordPress.
- On the Accounts tab, select “Create Account”

2. On the following page, fill out the necessary fields, then choose “Create” and accept the terms. You’ll be shown a screen with two chunks of code – don’t close this screen! We need it for the next steps.

Step 4: Connect Google Tag Manager and WordPress
Now, you’ll need to install Google Tag Manager onto your WordPress website. This is essential so that the website and GTM can actually talk to each other.
- In a new tab or screen, open your WordPress website and install a code snippet plugin to add the code. We like this one from WPCode.
- Once the plugin is installed and activated, go to the Code Snippets menu item in the backend of your site and choose “Add Snippet.”

3. Find and select the “Add Your Custom Code” option.
4. Select the “PHP Snippet” option and add a title to the Snippet. We recommend something clear and specific like “Google Tag Manager head”
5. Do not close this screen, but go back to your GTM screen and copy the code in the first text box. Paste it into the “Create Custom Snippet” area we were just in in WordPress.
6. Scroll down and select the Location dropdown. From the available options, choose “Site Wide Header”

7. Up at the top, select “Save Snippet.”
8. The GTM code needs to fit into two different spots: in the “<head>” part of the page and the opening of the “<body>” tag. You just did the “<head>” part. Now it’s time for the “<body>” part. The process is identical except for three things:
- Copy and paste the <body> code (the second box in GTM)
- Name your new Code Snippet “Google Tag Manager body”
- When you save the Code Snippet in WordPress, select “Site Wide Body” under “Location”
Step 5: Create New Tag and Trigger in Google Tag Manager
- Go back to Google Tag Manager. At this point you can close the screen that shows your code.
- Find and select the “Tags” menu item on the left, then “New”, then “Triggering”
- It will take you to a screen that looks like this. Choose “All Pages”

4. On the following screen, select “Choose a tag type to begin setup”
5. Select “Custom HTML”
6. Name the Tag “Local Schema Markup”
7. Go back to the Micro Data Generator screen, and copy/paste your schema code into the GTM screen’s HTML section. Then “Save.”

Step 6: Test Again
Ensure that the schema markup is working by using the Validator again. But we’ll do it slightly differently this time.
- On the validator screen, select “Run New Test.”
- On the screen that pops up, stay on the part that’s titled “Fetch URL”
- Copy and paste your website URL into the field, then select “Run Test”
- The Validator will reveal whether or not it’s finding your schema on the website. It will also provide you with details about any potential errors or warnings.

Frequently Asked Questions Regarding How to Add Local Schema to a Website
Local schema is a type of schema markup that prioritizes details about businesses that have a physical location by including details like your company’s address, phone number, and hours of operation. It gives a search engine the information it needs to potentially add your site to map results and rich snippets.
Local schema gives Google the context it needs to provide accurate search results to users. If someone is looking for a business near them, Google can use the local schema in your site to know you’re a good option. Other schemas prioritize different information for different types of searches.
You should not use the local schema type unless you have a physical location that people can go to. You can use the Organization or Service schema types instead in order to provide proper context.
In order to use local schema for a business that has more than one physical location, you should create a unique landing page for each location. Then use schema markup to each page individually. They should contain unique details, like the phone number, hours, and address.
