How To Set Up LocalBusiness Schema Using JSON-LD On a WordPress Website

Primer

This tutorial is for anyone who is using WordPress. If you used Microdata to implement Schema in the past, you had to mark up the content that was actually on the page. This caused formatting issues and took a long time to get the page looking right. With JSON-LD it’s much easier. You can have your content on the page and style it the way you want. The JSON-LD script is separate than the content on the page. But you need to make sure that the information you are including in the JSON-LD script is also included on the contents of the page.

Step 1

Make sure to add your business name, address and phone to each page on your website. The easiest way is to add it to the footer of your website. You can add other pieces of info to each page such as email address if you’d like as well. Just make sure that whatever you include in the JSON-LD script is also viewable by website visitors on each page that contains the JSON-LD script. Some info is not necessary for viewers though, such as lat and long coordinates.

Step 2

Install the SOGO Add Script Header Footer plugin. It’s free and can be found here.

Step 3

Configure the SOGO Add Script Header Footer plugin. Go to the “Setting” tab in your WordPress admin. Click on “Header Footer Settings”.

Once you are in the SOGO Add Script Header Footer settings area, check the boxes next to “Limit Footer To” for “Post” and “Pages”. This means you want this script to be included on all post and web pages. You can check the other boxes if you’d like. That’s all depends on what types of content you want this script to be included on. For LocalBusiness Schema purposes, you really only need this on posts and pages.

Step 4

Copy and paste this JSON-LD template into a text editor. I like Brackets. It’s also free. Replace all of the information in capital letters with your own business information.


<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@type" : "LocalBusiness",
  "@id" : "WEBSITE URL",
  "name" : "BUSINESS NAME",
  "hasMap": "https://maps.google.com/maps?cid=YOURCIDNUMBER",
  "logo" : "LOGO URL",
  "telephone" : "PHONE NUMBER",
  "email" : "EMAIL ADDRESS",
  "sameAs" : [ "URL #1", "URL #2" ],
  "url" : "WEBSITE URL",
  "image" : "IMAGE URL",
  "priceRange" : "$000 - $000",
  "description" : "BUSINESS DESCRIPTION",
  "address" : {
    "@type" : "PostalAddress",
    "streetAddress" : "STREET ADDRESS",
    "addressLocality" : "CITY",
    "addressRegion" : "STATE ABBREVIATION",
    "postalCode" : "ZIP CODE"
  },
  "geo" : {
    "@type" : "GeoCoordinates",
    "latitude" : "LATITUDE COORDINATES",
    "longitude" : "LONGITUDE COORDINATES"
  }
        }
    }
  ]
}
</script>

Use this guide to find the CID number for your Google My Business listing.

Step 5

Now copy and paste the JSON-LD script that you just customized in your text editor. Paste it into the SOGO Add Script Header Footer settings in the “Footer” box. Now click “Save Changes”.

Note: You can add the code anywhere on your website. It doesn’t matter if you place it in the head or the body section. Google will have no problem reading the code. Since JSON-LD is a data linking format, there are no additional requests to the server. Therefore, it doesn’t matter if the script is loaded at the top or bottom of the page – there is no render delaying whatsoever.

Reference: https://whitespark.ca/blog/the-json-ld-markup-guide-to-local-business-schema/

Step 6

Once you have added this script to your website, you will need to confirm that you have implemented the code correctly by using Google’s Structured Data Testing Tool. Simply enter the URL of the website that you installed the script on under the “Fetch URL” tab. Or you can copy and paste the script into Google’s Structured Data Testing Tool under the “Code Snippet” tab.

About Dani Owens

Dani Owens, the owner of Pigzilla, has been in the digital marketing field since 2011. Her resources have been mentioned and shared by local SEO experts such as Eric Ward, Darren Shaw, Phil Rozek, Marie Haynes, David Mihm and Local U. From small, independent Mom-and-Pop shops, to enterprises with thousands of locations, Dani Owens has years of experience strategizing and implementing reliable local SEO tactics that lead to increased organic traffic and conversions.