How to Implement JSON-LD
-
Hi,
I was implementing JSON-LD via Google Tag Manager but have since read that it is better to place directly on the web page.
My questions are:
-
Where exactly do you add the JSON-LD - I mean physically? This article by Moz says the head or body. Does it matter where in the head? At the end?
-
If you do not have development access- is there an easy way to insert?
-
Can you view the added JSON-LD directly on the web page after you have added it or is it not visible in the source once you have added it this way ? If you cannot see it, how do you view? Or it it just OK to use the Google Structured Testing tool as evidence that it is being seen by Google?
Thanks
-
-
Thank you.
-
For Wordpress, it depends if you have it set to filter out script tags from content. So, if you toggle content editing mode to html, and put in a script tag, whether it allows this or not. That is a setting in Wordpress. If it is filtering out your script tags, and if you don't want to (or can't) disable the script tag filtering, then using a plugin to administer the schema markup would be your best bet. There are generic plugins to insert script tags. And there are more specific plugins for schema markup, like Yoast (and others).
If you are inserting the scripts through GTM, then you may not see them when you simply "view source". With tag managers, you will see their container in the source code, but not the injected scripts. But if you instead use Chrome Developer Tools (right click and choose "inspect"), on the elements tab you will most likely find the injected scripts.
-
Thanks for the great response.
For question 2)
If your CMS is Wordpress and you don't have development access, how do you add the script? I'm assuming that the page is a static page. You basically just paste it into the page?
For question 3)
Could you explain why you can't see the asynchronous script in the source code. I'm not overly sure about this part and I'd like to understand it a bit better. When I used Google Tag Manager I couldn't see the script and I don't understand why not. Are you able to explain technically what happens with injecting it via GTM versus on the page itself?
Thank you
-
In answer to your questions:
1. You can place the JSON-LD in either location. If you are making use of data which may not be available at the beginning of the page load, then you might prefer to place at the very bottom of your body tag. But both locations work if you are simply inserting static content.
2. If you are using a CMS, you can simply insert the script as static content (as long as your CMS allows you to insert a script). This is assuming your page is a static page, not one which dynamically changes based on some server-side application. So, for example, if you have an article page on your site, and you want to insert schema to mark up that article, then this would be straightforward to do by simply inserting a script. But if your site is an e-commerce site and you are wanting to mark up all of your product details pages with product information, then this might be better done as part of the application. For static markup, if you search for "json ld generator" you will find some handy tools to simplify creating static scripts. Just be careful that you do not use static markup on a dynamic page where the page content might change based on application data, then causing inconsistency between your markup and the actual page content.
3. If you insert through your CMS, then yes you should see your script in the source code. If you use an ansynchronous script to inject your JSON-LD, then you might not see it in your source code, but could still see it by using dev tools inspect, after the page finishes loading. Either way, then use the Google Structured Data Testing Tool on the live URL to confirm that Google is able to parse the markup properly, with no errors. When you do that, look at its results to make sure the hierarchy of the data looks appropriate to you based on the data you know is on the page.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Hreflang tag implementation
Hi Mozzers, For an international client, we want to install hreflang tags for 3 different languages for their website in Belgium: dutch, french and english. The dutch version (nl-be) and the french version (fr-be) can perfectly be installed, but our developer has troubles implementing the english version (en-be). According to ISO 639-1 , "en-be" is apparently not supported. Unfortunately, we can't generalize the hreflang tags (), because our client has different websites in each country, so we need to specifically target Belgium here. Does anyone have a solution? Thanks,
Technical SEO | | WeAreDigital_BE
Jens0 -
Adding Reviews to JSON Product Schema Markup
Hi everyone, Below is an example of some JSON product schema markup I'd like to integrate into my site. My question is, what do I need to do to incorporate the individual reviews on a product page as well? I've tried a few different things but I can't get it to validate.
Technical SEO | | VDigitalServices0 -
Why is Coyscape showing content duplication error even after implementing 301 redirect ?
We are maintaining the corporate website of one of our prestigious clients "FineTech Toolings" (http://www.finetechtoolings.in). Recently I had raised a question regarding "2 websites running paralley in 2 diferent domains, i.e. 1 organisation having 2 different websites on 2 different domains". Recently my domain changed from http://www.finetechtoolings.co.in to http://www.finetechtoolings.in via 301 redirect, but still I am facing content duplication issue as per Copyscape. Hence I am having a small doubt regarding the same. Please note the following question very carefully and provide me the exact problem and the solution for the same: Even though I have implemented 301 redirect (http://www.finetechtoolings.co.in is redirected to http://www.finetechtoolings.in), which is completely ok as per the SEO rules, why is copyscape still showing that duplicate content exists in the former website? I think I am clear enough with my question.
Technical SEO | | KDKini0 -
Schema.org implementation for physician's office vs physician herself?
Hi, Regarding schema.org microdata, which page(s) should have the microdata? 1) http://schema.org/Physician -- appears to be about the office. Since we have all of the contact/address info in the footer on each page, should we do the same with microdata? I can't seem to find a suggested implementation on schema.org Assuming an office has multiple MDs, how should the docs be listed since the physician schema appears to be for the office, not for the individual doctors? Thanks for any insight!
Technical SEO | | Titan5520 -
Half Implemented HTML 5 Structure
Hi there, I have just notced on a website that it has a halt implemented html 5 structure. Well, when I say half implemented, it has the doctype and then one <header>section. After that all of the divs are custom ones that have been added for the CSS. Could this lack of structure have a negative effect on the site? Cheers, Edward </header>
Technical SEO | | edwardlewis0 -
How do you implement pages requiring login?
I'm running a site with a member area and some public accessible pages. The member area obviously requires users to authenticate, while the public pages are indexable by search engines. Our global navigation includes links to the restricted pages. At the moment, when a user isn't logged in and accesses a restricted page, we're 302-redirecting them to a login page. We have a lot of external links pointing to restricted pages (eg. profile pages), and since we're 302-redirecting the juice from these links are lost. I've been thinking about changing the redirect from 302 to 301. How would this look from a search engines view? The pages aren't per se permanently moved - the current user just isn't authenticated to view the content of the page at the moment. Would it be a problem that navigation contains multiple internal links that all 301 redirect to the same login page? Any suggestions? Thanks.
Technical SEO | | jonesjitter0 -
Why am i still getting duplicate page title warnings after implementing canonical URLS?
Hi there, i'm having some trouble understanding why I'm still getting duplicate page title warnings on pages that have the rel=canonical attribute. For example: this page is the relative url http://www.resnet.us/directory/auditor/az/89/home-energy-raters-hers-raters/1 and http://www.resnet.us/directory/auditor/az/89/home-energy-raters-hers-raters/2 is the second page of this parsed list which is linking back to the first page using rel=canonical. i have over 300 pages like this!! what should i do SEOmoz GURUS? how do i remedy this problem? is it a problem?
Technical SEO | | fourthdimensioninc0 -
How to implement 503 status?
Hello, I want to know how to implement 503 status for a website hosted on Windows server? Will this code trigger automatically as per some specific condition or is it done manually? THanks & Regards
Technical SEO | | IM_Learner0