-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(gatsby-plugin-guess-js): Document JWT #15969
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ module.exports = { | |
options: { | ||
// Find the view id in the GA admin in a section labeled "views" | ||
GAViewID: `VIEW_ID`, | ||
// Add JWT token to perform authentication on deployment builds | ||
jwt: GA_JWT | ||
minimumThreshold: 0.03, | ||
// The "period" for fetching analytic data. | ||
period: { | ||
|
@@ -50,7 +52,7 @@ module.exports = { | |
|
||
## Integrating with CI | ||
|
||
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 - you need to send a jwt to authenticate properly | ||
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 | ||
|
||
```javascript | ||
// In your gatsby-config.js | ||
|
@@ -77,3 +79,7 @@ module.exports = { | |
], | ||
} | ||
``` | ||
|
||
### How to get a JWT token? | ||
|
||
[Here](https://2ality.com/2015/10/google-analytics-api.html) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like we should just copy and modify https://2ality.com/2015/10/google-analytics-api.html#unlocking-the-google-analytics-api in the readme and give credits to 2ality url. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another good point, I would probably be welcome to more suggestions as to how to do this in a simpler way (if possible?). Maybe attaching something to a gatsby preBuild api to get a fresh JWT. My knowledge on JWT is a little limited but I would assume that this wouldn't be the best way as each JWT is valid until you make it non valid correct? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain what GA_JWT holds?
For gatsbyjs.org we're doing the following to make it work:
ENV vars look like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good point, tried to follow the rabbit hole into Guess webpack and ga packages but haven't been able to work out where this goes yet. I can see that client_email, private_key combo in
www/
but it appears to be commented out currently?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a bug with guess so that's why :)