Google show stars in Google search with JavaScript dynamically generated rich snippets?

I'm thinking about starting a widget that my users will put in their website. My widget will generate rich snippets in order to allow Google show stars on Google search.

I know that rich snippets work when they are put in static HTML. Can they be dynamically generated via JavaScript as well?

  • Sure. Why not? As long as the code created by the widget is correct, it will work just fine.
    – closetnoc
    Oct 17, 2014 at 18:00
  • Yes, but depends on the service or product your website uses... using the marking doesn't necessary mean you will receive stars. Oct 18, 2014 at 0:43
  • @closetnoc I think it my not work because google cannot crawl 100% dynamically generated widgets
    – Cleyton
    Oct 20, 2014 at 11:29
  • Are you saying that the microdata is placed into the page dynamically by JavaScript? I don't think that Googlebot is going to be able to see that. Please explain more about exactly how this works. Nov 7, 2014 at 11:26
  • Yes @StephenOstermiller . I've added more details for my question
    – Cleyton
    Nov 7, 2014 at 11:49

2 Answers 2


Google says that they can read dynamically added structured data if the JSON-LD syntax is used:

Also, Google can read JSON-LD data even when it is dynamically injected into the page's contents, such as by Javascript code or embedded "widgets".

They don’t document this for the other syntaxes they support (Microdata, RDFa), but this doesn’t necessarily mean that they can’t/won’t read it.

  • searchengineland.com/… Also seems to confirm various DOM mitigations are good to go. Doesn't test JSON-LD but we can infer, especially if based on the quote you provided.
    – dhaupin
    May 15, 2015 at 1:35

I tested now and it didn't work.

In general Google can process JavaScript just fine, but considering these should be static tags it probably considers it doesn't comply with standards and ignores them (if printed with JavaScript).

  • How long did you wait to see live results? Not sure if their testing tool runs scripts...could take months for live validate and GWT to report it.
    – dhaupin
    May 15, 2015 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.