
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
gatsby-plugin-guess-js
Advanced tools
Gatsby plugin providing drop-in integration with Guess.js to enabling using machine learning and analytics data to power prefetching
Gatsby plugin for integrating Guess.js with Gatsby.
Guess.js is a library for enabling data-driven user-experiences on the web.
When this plugin is added to your site, it will automatically download Google Analytics data and use this to create a model to predict which page a user is most likely to visit from a given page.
The plugin uses this information to do two things.
<link prefetch>
for resources on pages
the user is likely to visit. This means that as soon as a person visits your site, their browser
will immediately start downloading in the background code and data for links they'll likely click on which
can dramatically improve the site performance.https://guess-gatsby-wikipedia-demo.firebaseapp.com
npm install gatsby-plugin-guess-js
// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: "gatsby-plugin-guess-js",
options: {
// Find the view id in the GA admin in a section labeled "views"
GAViewID: `VIEW_ID`,
// Add a JWT to get data from GA
jwt: {
client_email: `GOOGLE_SERVICE_ACCOUNT_EMAIL`,
private_key: `GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY`,
},
minimumThreshold: 0.03,
// The "period" for fetching analytic data.
period: {
startDate: new Date("2018-1-1"),
endDate: new Date(),
},
},
},
],
}
Integrating this plugin within a CI pipeline may cause errors because the plugin will prompt the user/machine to log into the Google Analytics account. To get around this you'll need to generate a JWT for your GA account to pass to the plugin, this will enable the plugin to work in prod without any human interaction to authenticate permissions
// In your gatsby-config.js
module.exports = {
plugins: [
{
resolve: "gatsby-plugin-guess-js",
options: {
// Find the view id in the GA admin in a section labeled "views"
GAViewID: `VIEW_ID`,
minimumThreshold: 0.03,
// Set Google Analytics jwt with Google Service Account email and private key
jwt: {
client_email: `GOOGLE_SERVICE_ACCOUNT_EMAIL`,
private_key: `GOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY`,
},
// The "period" for fetching analytic data.
period: {
startDate: new Date("2018-1-1"),
endDate: new Date(),
},
},
},
],
}
Excerpt from https://developers.google.com/identity/protocols/oauth2/service-account
node_modules
that is inside one of the parent directories of the script that we’ll create later. That means that you can keep it out of the repository with analytics.js
. For example, the following path is perfectly fine:
\$HOME/node_modules/myproject-3126e4caac6a.json
client_email
address (which is displayed in the user interface and stored inside the JSON file). Copy that email address.Go to the Admin panel in Google Analytics:
client_email
.Note: This JWT will only be valid for a finite amount of time. If you would like to generate a token that will not expire, please follow further instructions in https://2ality.com/2015/10/google-analytics-api.html
FAQs
Gatsby plugin providing drop-in integration with Guess.js to enabling using machine learning and analytics data to power prefetching
We found that gatsby-plugin-guess-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 19 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.