Skip to content

Commit 947acb2

Browse files
authored
add jwt credentials as a mandatory attribute to guess plugin (docs update) (#337)
* add jwt credentials as a mandatory attribute to guess plugin, update the docs * readme update without jwt credentials * updated readme line breaks * docs spelling
1 parent 6df1dd5 commit 947acb2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.DS_Store
2+
.idea
23
.vscode
34
build
45
node_modules

packages/guess-webpack/README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const { GuessPlugin } = require('guess-webpack');
1919
Add this to the end of your webpack config:
2020

2121
```js
22-
new GuessPlugin({ GA: 'GOOGLE_ANALYTICS_VIEW_ID' });
22+
new GuessPlugin({ GA: 'GOOGLE_ANALYTICS_VIEW_ID'});
2323
```
2424

2525
## Usage
@@ -89,8 +89,10 @@ In case you're interested in automating the process of prefetching of bundles in
8989

9090
```ts
9191
import { parseRoutes } from 'guess-parser';
92+
const credentials = require('./credentials.json');
9293

9394
GuessPlugin({
95+
jwt: credentials,
9496
GA: 'XXXXXX',
9597
routeProvider() {
9698
return parseRoutes('.');
@@ -104,6 +106,9 @@ GuessPlugin({
104106
At build time, the snippet above will first create mapping between paths and lazy-loaded JavaScript bundles. At runtime, while the user is navigating in the application a small runtime will invoke `guess` to make predictions for the pages which are likely to be visited next. At each step, Guess.js will pick the top paths and prefetch their corresponding bundles.
105107

106108
Keep in mind that `parseRoutes` might not be able to properly create the mapping between the routes and the bundles in applications with very dynamic route definition, for example most React and Vue applications are not supported. For further information on `guess-parser` look at the [package's documentation](https://github.com/guess-js/guess/tree/master/packages/guess-parser).
109+
110+
Also, keep in mind that **authentication** with google (once a GA VIEW_ID is set) can be done by OAuth2 (chrome pop up)
111+
**OR** with a JWT token (like the example above) download as credentials.json by using: [guess-ga documentation](https://github.com/slavoroi/guess/tree/master/packages/guess-ga) and add it to .gitignore due to security reasons .
107112

108113
### Custom Route Provider
109114

0 commit comments

Comments
 (0)