Is it possible to create a page with different structured data depending on the URL parameters?
Also, Google can read JSON-LD data when it is dynamically injected into the page's contents, such as by JavaScript code or embedded widgets in your content management system.
Example
- There is a page with the address
https://example.com/some/page/url.html?attribute3=5
. - There are structured data on this page.
- This page has a dropdown.
- The URL parameters specify what dropdown value to select.
- When the page is loaded, the value specified in the URL parameter is selected.
- The value of dropdown is changed using JavaScript.
- When you change the value of dropdown, the structured data changes.
- In the Structured Data Testing Tool, structured data remains unchanged regardless of the URL parameters.
A simple example page
and result in Structured Data Testing Tool.
In the example, only the price is passed and changed in the URL parameter (https://testforstackoverflow.github.io/jsonld.html?p=2
).
Probably Google ignores the URL parameters when reading structured data or reads structured data before JavaScript is used.