Example of using Deferred Static Generation (DSG) for pages in your Gatsby site, depending on which pages are the most visited. The list of most viewed pages is determined by accessing Plausible Analytics.
You can use this example for the analytics tool you use, the general idea & setup will be the same.
Read the full blogpost Using Deferred Static Generation with Analytics Tools to learn more!
- Create a local plugin to access the needed data from your analytics tool
- In this plugin, create GraphQL nodes in the
sourceNodes
lifecycle - Use the data from your analytics plugin to mark pages in the
createPages
lifecycle asdefer
or not