Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

updated example of injecting browser agent #84

Merged
merged 5 commits into from
Sep 12, 2022

Conversation

bizob2828
Copy link
Member

@bizob2828 bizob2828 commented Sep 7, 2022

Proposed Release Notes

  • Updated injecting browser agent snippet in both README and docs.
  • Updated example application to include the browser agent snippet and README to using example project.

Links

Details

README.md Outdated
@@ -131,7 +144,7 @@ Error.getInitialProps = ({ res, err }) => {
export default Error;
```

The example above assumes that both the New Relic Browser and Node.js agents are integrated. `getInitialProps` function's `if` statement checks whether an error was thrown on the server side (`typeof window === "undefined"`) and if it was the case, it `requires` New Relic Node.js agent and sends an `err` with `noticeError` method. Otherwise it assumes the error was thrown on the front-end side, and uses the browser agent to send the error to New Relic by using `window.newrelic.noticeError(err)`.
The example above assumes that both the New Relic Browser and Node.js agents are [integrated](#client-side-instrumentation). `getInitialProps` function's `if` statement checks whether an error was thrown on the server side (`typeof window === "undefined"`) and if it was the case, it `requires` New Relic Node.js agent and sends an `err` with `noticeError` method. Otherwise it assumes the error was thrown on the front-end side, and uses the browser agent to send the error to New Relic by using `window.newrelic.noticeError(err)`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For clarity, I think I'd prefer

The getInitialProps function's if statement

to not having the initial "The."

Copy link
Contributor

@jordigh jordigh Sep 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The American Mathematical Society's style guide recommends not beginning a sentence with a symbol. I think that helps reading, because the eyes use both punctuation and capitalisation to see a new sentence. I bet our doc writers have similar ideas.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took me a while to figure out the ask here but updated!

mrickard
mrickard previously approved these changes Sep 9, 2022
@bizob2828 bizob2828 merged commit 383c91f into newrelic:main Sep 12, 2022
@bizob2828 bizob2828 added the documentation Improvements or additions to documentation label Sep 19, 2022
@github-actions github-actions bot mentioned this pull request Oct 17, 2022
bizob2828 added a commit to bizob2828/newrelic-node-nextjs that referenced this pull request Jul 26, 2024
…ample

updated example of injecting browser agent
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
Archived in project
3 participants