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
-
Why have my positions dropped after implementing recommended changes?
Hello! I have taken a Moz free trial and am really enjoying using this service. But, after implementing the recommended changes by Moz my rankings have really dropped. Is this normal? I was averaging around 17 but now averaging 40. Here is my website if anyone has any ideas of what I might be doing wrong, I would greatly appreciate any help.
Technical SEO | | NicoleChambers
Thank you
Nicole0 -
What is SEO best practice to implement a site logo as an SVG?
What is SEO best practice to implement a site logo as an SVG?
Technical SEO | | twisme
Since it is possible to implement a description for SVGs it seems that it would be possible to use that for the site name. <desc>sitename</desc>
{{ STUFF }} There is also a title tag for SVGs. I’ve read in a thread from 2015 that sometimes it gets confused with the title tag in the header (at least by Moz crawler) which might cause trouble. What is state of the art here? Any experiences and/or case studies with using either method? <title>sitename</title>
{{ STUFF }} However, to me it seems either way that best practice in terms of search engines being able to crawl is to load the SVG and implement a proper alt tag: What is your opinion about this? Thanks in advance.1 -
Despite proper hreflang and lang attribute implementation using xml sitemaps, I'm seeing sitelinks from different countries. Any help please?
When someone searches for our brand in US, instead of only US links, users are served with canadian or iranian sitelinks. Despite we have properly implemented xml sitemaps with hreflangs, even we have implemented lang attribute in the head section of source code for every country. I'd be thankful for any advice.
Technical SEO | | eset0 -
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 -
Breadcrumb JSON Extraction?
Sorry the title may not make the most sense as I'm not entirely sure what my question would be phrased as. https://developers.google.com/structured-data/breadcrumbs#examples We have breadcrumbs on our site, these are generated by a plugin. So for example we have: Where am I: Homepage Page 1 [Page 2](../../Page 2 "Page 2") <a id="ctl00_RptBreadcrumbs_ctl04_link" title="Page 3">Page 3</a> Do we have any way where we can implement this without development being involved? Alternatively is there anyway to use the current url? (as we do use folders) so an example being: http://domain.com/page1/page2/page3 Probably not possible but I live in hope.
Technical SEO | | ThomasHarvey0 -
Implementation of rel="next" & rel="prev"
Hi All, I'm looking to implement rel="next" & rel="prev", so I've been looking for examples. I looked at the source code for the MOZ.com forum, if anyone one is going to do it properly MOZ are. I noticed that the rel="next" & rel="prev" tags have been implemented in the a href tags that link to the previous and next pages rather than in the head. I'm assuming this is fine with Google but in their documentation they state to put the tags in the . Does it matter? Neil.
Technical SEO | | NDAY0 -
My homepage+key pages have dropped 40+ positions after implementing redirects and canonical changes. HELP!
Hi SEOMozers, I work for a web based nonprofit at www.tisbest.org. I had a professional contact recommend that we work on our redirects to our homepage because we were losing valuable rank benefit. This combined with getting sick of seeing our weekly SEOMoz crawl reports show 304 duplicate page and title errors for months. No one could seem to figure out what was happening (we think it had to do with session stuff; we were seeing several versions of each page showing the following: www.tisbest.org/default.aspx/(random character string) My developer and I read a bunch of articles and started making changes 10 days ago: He setup 301 redirects from http://tisbest.org to http://www.tisbest.org. (set the canonical domain). We did a redirect from http://www.tisbest.org/default.aspx to root with "/". I set the canonical setting to www.tisbest.org in our webmaster tools. In our web config (we're running in asp.net), we changed our session detection from auto-detect then saw some session funkiness so we changed it back. Though we do think the character strings we were seeing were session GUID. He forced lower case URL’s to reduce duplicate page content/titles. I got my weekly crawl report 9 days ago and we had dropped from 340 duplicate page title and page content errors went to one. We went nuts and felt like the kings of SEO. Then, yesterday (9/28), the SEO grim reaper came knocking when I received my weekly SEOMoz ranking report. It said we had dropped 40+ spots for all of 9 of our keywords. Sure enough, I searched our keywords and our website was gone. Then I searched our company name, tisbest, and only a few of our pages show but not the homepage. I searched for our URL www.tisbest.org, and I originally got the expanded view (with 8 links to various webpages - can't remember what this view is called) but now, today (Saturday), the expanded view is gone from this search result. Also, when I run the On Page Report card for our homepage, I get the following error message with no results: "We were unable to grade that page. The page did not load. Curl::Err::TooManyRedirectsError: Number of redirects hit maximum amount." When I run the Open Site explorer report, I get this message at the top: Oh Hey! It looks like that URL redirects to www.tisbest.org/?AspxAutoDetectCookieSupport=1. Would you like to see data for <a class="clickable redirects">that URL instead</a>?" If I go to the report for the that report's page, it says that "No information is available for that URL." Just tonight (night of 9/29), our developer added the rel="canonical" href="http://www.tisbest.org" /> to our homepage tonight to see if that would help. We did not do that originally. In our Google Webmaster tools, I am seeing the number of URL Error - Not Followed has sky rocked. I have attached a screen capture to this thread. There are also a large number of URL Errors - Not Found errors as well. I did some research tonight and downloaded and ran Screaming Frog SEO Crawler. I have attached a screen capture below with this report and a couple of questions I sent our developer that may be helpful to you. Also, not sure if this is relevant, we use a master page that all of our pages inherit from so all of our pages get the same meta-data: name="keywords" content="charitable gift card, charitable gift certificate, non profit gift card, charity donation, giftcard, charity gift card, donation gift card, donation gift, charity gift, animal gift card, animal gift, environmental gift card, environmental gift, humanitarian gift card, humanitarian gift, christian gift card, christian gift, catholic gift card, catholic gift, religious gift card, religious gift" />id="ctl00_metaDescription" name="description" content="Award winning Charity Gift Card, for over 250 premier charities. A customized donation gift that makes the world better. TisBest is BBB Accredited." />name="google-site-verification" content="EfJIhN3h2SVSXdSpUbfceBVw2q6zrGX8rRQhdNZ1xY8" /><title></span><span> </span></p> <p>Can anyone help me/us identify the issue that obliterated our rankings? I am happy to give an information needed. Thank you! Chad Edwards</p> <a download="Bqcu1.png" class="imported-anchor-tag" href="http://i.imgur.com/Bqcu1.png" target="_blank">Bqcu1.png</a> <a download="ZXQ8d.png" class="imported-anchor-tag" href="http://i.imgur.com/ZXQ8d.png" target="_blank">ZXQ8d.png</a></title>
Technical SEO | | TisBest0 -
Is this tabbed implementation of SEO copy correct (i.e. good for getting indexed and in an ok spot in the html as viewed by search bots?
We are trying to switch to a tabbed version of our team/product pages at SeatGeek.com, but where all tabs (only 2 right now) are viewed as one document by the search engines. I am pretty sure we have this working for the most part, but would love some quick feedback from you all as I have never worked with this approach before and these pages are some of our most important. Resources: http://www.ericpender.com/blog/tabs-and-seo http://www.google.com/support/forum/p/Webmasters/thread?tid=03fdefb488a16343&hl=en http://searchengineland.com/is-hiding-content-with-display-none-legitimate-seo-13643 Sample in use: http://www.seomoz.org/article/search-ranking-factors **Old Version: ** http://screencast.com/t/BWn0OgZsXt http://seatgeek.com/boston-celtics-tickets/ New Version with tabs: http://screencast.com/t/VW6QzDaGt http://screencast.com/t/RPvYv8sT2 http://seatgeek.com/miami-heat-tickets/ Notes: Content not displayed stacked on browser when Javascript turned off, but it is in the source code. Content shows up in Google cache of new page in the text version. In our implementation the JS is currently forcing the event to end before the default behavior of adding #about in this case to the url string - this can be changed, should it be? Related to this, the developer made it so that typing http://seatgeek.com/miami-heat-tickets/#about directly into the browser does not go to the tab with copy, which I imagine could be considered spammy from a human review perspective (this wasn't intentional). This portion of the code is below the truncated view of the fetch as Googlebot, so we didn't have that resource. Are there any issues with hidden text / is this too far down in the html? Any/all feedback appreciated. I know our copy is old, we are in the process of updating it for this season.
Technical SEO | | chadburgess0