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
-
JSON-LD meta data: Do you have any rules/recommendations for using BlogPosting vs Article?
Dear Moz Community. I'm looking at moving from in-line Microdata in the HTML to JSON-LD on the web pages that I manage. Seems a far simpler solution having all the meta data in one place - especially for trouble shooting! With this in mind I've started to change the page templates on my personal site before I tackle the ones for my eCommerce site. I've made a start, and I'm still working on the templates producing some default values (like if a page doesn't have an associated image) but have been wondering if any of you have any rules/recommendations for using BlogPosting vs Article? I'd call this type of page an Article:
Technical SEO | | andystorey
https://cycling-jersey-collection.com/browse-collection/selle-italia-chinol-seb-bennotto-1982-team-jersey Whereas this page is from the /blog so that should probably be a BlogPosting:
https://cycling-jersey-collection.com/blog/2017-worldtour-team-jerseys I've used the following resources but it would be great to get a discussion on here.
https://yoast.com/structured-data-schema-ultimate-guide/
https://developers.google.com/search/docs/data-types/data-type-selector
https://search.google.com/structured-data/testing-tool/u/0/ I'm keen to get this 100% right as once this is done I'm going to drive through some further changes to get some progress on things like this: https://moz.com/blog/ranking-zero-seo-for-answers
https://moz.com/blog/what-we-learned-analyzing-featured-snippets Kind Regards andy moz-screenshot.jpg1 -
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 -
Implemented google adwords via tag manager do it still require to paste script at thank you page?
Hi All Experts, I have implemented google adwords with tag manager, so now query is still it is required to place the google adwords scripts at thank you page?
Technical SEO | | varo0 -
Product Schema implementation
Hi Once you have added structured data to a web page, say adding 'product schema' to a product page how long can you reasonably expect before it take effects, ie. displays rich snippets ? Also in the case of product schema what triggers the display of the rich snippet ? is it a branded keyword and product title search or just a product title search or can it result from a generic keyword search too ? All Best Dan
Technical SEO | | Dan-Lawrence0 -
Schema.org : reviewCount & ratingValue - best practices for implementation?
I'd like to add our merchant review count and rating to our site and use the schema.org markup to indicate to the search engines what these are. The reason I'd like to do this is so that the star rating pulls through to the organic listing. Check out this example from several UK tight sites. Notice how the organic listings display the star rating... My questions are: Has anyone seen an example of this from Google.com (US site) I heard that you should only add this markup to the homepape - but couldn't find any Google documentation to back this up. Do you know if this can be applied throughout the site w/o penalty? Thanks everyone!
Technical SEO | | evoNick0 -
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 -
Implementing Schema within Existing CSS tags
In implementing Schema with a site using CSS and containing existing tags, I want to be sure that we are (#1) using the tags effectively when used within a product detail template and (#2) not actually harming ourselves by telling Google that all products are named or described by the SS tag and not actually the product name or description (which obviously could be disasterous). An example of what we are looking at implementing is the following: Old: <ss:value source="$product.name"></ss:value> New: <ss:value source="$product.name"></ss:value> Old: <ss:value source="$product.description">New: <ss:value source="$product.description"></ss:value> Basically, is Schema at the point where the SS tag be replaced (in the eyes of the search engines) with the actual text and not the tag itself?</ss:value>
Technical SEO | | TechMama0 -
Json and crawlable content - simple explanation
Hi There, My IT colleagues are trying to improve performance on our homepage, and they suggest to use Json. They were inspired by Facebook that uses json. Now they ask me if this can have an impact on SEO. Most expert readings point to this page http://code.google.com/web/ajaxcrawling/ Fine. Can anyone explain me in a few simple words how I should proceed when I want to optimize my homepage http://www.example.com/ for both performance and crawling when using json. Do i need 2 separate pages (ugly/pretty)? Kind regards Pieter
Technical SEO | | TruvoDirectories0