by daliborgogic

daliborgogic / guess-nuxt

Predict the next page (or pages) a user is likely to visit and prefetch these pages, improving perce...

125 Stars 2 Forks Last release: about 1 year ago (1.0.0) 21 Commits 1 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

Guess.js + Nuxt.js

Guess.js is a collection of libraries & tools for enabling data-driven user-experience on the web.

Nuxt.js is a Vue.js Meta Framework to create complex, fast & universal web applications quickly.


In this particular example, we combine Guess.js with Nuxt.js to introduce predictive prefetching of JavaScript bundles. Based on user navigation patterns collected from Google Analytics or other source, Guess.js builds a machine-learning model to predict and prefetch JavaScript that will be required in each subsequent page.

Based on early benchmarks, this can improve the perceived page load performance with 20%.

For more information on Guess.js, take a look at the following links: * Google I/O announcement by Addy Osmani * Introducing Guess.js - a toolkit for enabling data-driven user-experiences on the Web * Using Guess.js with static sites * Using Guess.js with Angular, React, and Gatsby


$ git clone [email protected]:daliborgogic/guess-nuxt && \
cd guess-nuxt && \
npm i

$ mv .env.example .env

Update GA in .env


$ npm run dev


$ npm run build


$ npm start


Guess.js (0.1.5 and above) works with Nuxt.js with only two points of integration. All you need to do is add the

and introduce a snippet for prefetching the pages which are likely to be visited Nuxt.

The following sections describe both points in details.

Webpack Config

All you need is to extend the webpack config of your Nuxt.js application is to add the

file, located in the root of your project. If the file does not exist, create it and add the following content:
const { GuessPlugin } = require('guess-webpack')
const { GA } = process.env

module.exports = { build: { extend(config, ctx) { if (ctx.isClient) { config.plugins.push( new GuessPlugin({ GA, runtime: { delegate: true }, routeProvider: false }) ) } } }

The routes that

returns depend on the Google Analytics report that it has extracted, together with the user's effective connection type.


Based on guess-next by Minko Gechev mgechev and Sébastien Chopin Atinux for pull request #1.



We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.