-
Notifications
You must be signed in to change notification settings - Fork 26.2k
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
Add with-google-analytics example #4036
Add with-google-analytics example #4036
Conversation
@prichodko Beware to apply this: GA.set({page: pageName})
GA.pageview(pageName) I've read somewhere that doing a simple |
@Vadorequest thanks for checking out and yes, this is true for old |
@prichodko I think you should format the code using |
394b2d6
to
d29379d
Compare
@mattiascibien thanks! Haven't noticed it. :) PR updated. |
@prichodko in any case I have included the code you provided on my site and it worked like a charm (even with static export). I will do something similar for azure appinsights I guess but I am still experimenting. |
e489aef
to
f7cb3c7
Compare
@timneutkens rebased :) |
|
||
export default class extends Document { | ||
static getInitialProps ({ renderPage }) { | ||
return renderPage() |
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.
const { html, head, errorHtml, chunks } = renderPage()
return { html, head, errorHtml, chunks, styles }
lets do it like in the readme
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.
Makes sense. Done ✅.
f7cb3c7
to
59e7493
Compare
59e7493
to
1b6abce
Compare
@timneutkens rebased |
Nice! |
Thanks for this example @prichodko! It'd be great if This is roughly how I approached this a few months back: https://gitlab.com/kachkaev/website-frontend/commit/c36a04d7674ca572f90374bbf83c02d1bde11300 |
@kachkaev you are definitely right! I tried to keep example as simple as possible. However for the env variables I would currently use a new feature released in |
Adds an example showing how to setup global site tag -
gtag.js
to send event data to Google Analytics.gtag.js
replaces olderanalytics.js
solution and is currently recommended by Google - https://developers.google.com/analytics/devguides/collection/gtagjs/migrationRelated: #160