@newrelic/browser-agent 1.292.0 → 1.292.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +96 -8
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/features/utils/agent-session.js +3 -2
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/features/utils/agent-session.js +3 -2
- package/dist/types/features/utils/agent-session.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/utils/agent-session.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.292.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.292.0...v1.292.1) (2025-06-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fix custom attribute race condition precedence ([#1507](https://github.com/newrelic/newrelic-browser-agent/issues/1507)) ([969f634](https://github.com/newrelic/newrelic-browser-agent/commit/969f634f4d22f112f3aba2fc2e74d6959dafbae5))
|
|
12
|
+
|
|
6
13
|
## [1.292.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.291.1...v1.292.0) (2025-06-16)
|
|
7
14
|
|
|
8
15
|
|
package/README.md
CHANGED
|
@@ -86,14 +86,63 @@ The following features may be disabled by adding `init` entries as shown above.
|
|
|
86
86
|
- `ajax`
|
|
87
87
|
- `generic_events`
|
|
88
88
|
- `jserrors`
|
|
89
|
+
- `logging`
|
|
89
90
|
- `metrics`
|
|
90
91
|
- `page_view_timing`
|
|
91
92
|
- `session_replay`
|
|
92
93
|
- `session_trace`
|
|
94
|
+
- `soft_navigations`
|
|
93
95
|
- `spa`
|
|
94
96
|
|
|
97
|
+
***Individual event types within the `generic_events` feature can also be disabled. See [Disabling Individual Generic Events](#disabling-individual-generic-events)***
|
|
98
|
+
|
|
95
99
|
See the [New Relic documentation site](https://docs.newrelic.com/docs/browser/browser-monitoring/getting-started/introduction-browser-monitoring/) for information on the above features.
|
|
96
100
|
|
|
101
|
+
### Disabling Individual Generic Events
|
|
102
|
+
The following event types reported by the `generic_events` feature can be individually disabled in the `init` configuration.
|
|
103
|
+
|
|
104
|
+
#### Page Actions
|
|
105
|
+
```javascript
|
|
106
|
+
const options = {
|
|
107
|
+
info: { ... },
|
|
108
|
+
loader_config: { ... },
|
|
109
|
+
init: {
|
|
110
|
+
page_action: {enabled: false}
|
|
111
|
+
...
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### User Actions
|
|
117
|
+
```javascript
|
|
118
|
+
const options = {
|
|
119
|
+
info: { ... },
|
|
120
|
+
loader_config: { ... },
|
|
121
|
+
init: {
|
|
122
|
+
user_actions: {enabled: false}
|
|
123
|
+
...
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Performance (Marks, Measures, Resources)
|
|
129
|
+
```javascript
|
|
130
|
+
const options = {
|
|
131
|
+
info: { ... },
|
|
132
|
+
loader_config: { ... },
|
|
133
|
+
init: {
|
|
134
|
+
performance: {
|
|
135
|
+
capture_marks: false, // disable performance mark collection
|
|
136
|
+
capture_measures: false, // disable performance measure collection
|
|
137
|
+
resources: {
|
|
138
|
+
enabled: false // disable performance resource collection
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
...
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
97
146
|
## Options Parameter
|
|
98
147
|
|
|
99
148
|
The `options` parameter used, or passed in, when instantiating the `BrowserAgent` class can include the following arguments:
|
|
@@ -118,6 +167,23 @@ The examples above use the `BrowserAgent` class, which is the best option for mo
|
|
|
118
167
|
|
|
119
168
|
Using the base `Agent` class, it is also possible to compose a custom agent by passing an array called `features` in the `options` object, containing only the desired feature modules. Depending on which features are included, this may yield a smaller loader script and improved performance.
|
|
120
169
|
|
|
170
|
+
The following feature modules are available for inclusion in the `features` array:
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
import { Ajax } from '@newrelic/browser-agent/features/ajax';
|
|
174
|
+
import { GenericEvents } from '@newrelic/browser-agent/features/generic_events';
|
|
175
|
+
import { JSErrors } from '@newrelic/browser-agent/features/jserrors';
|
|
176
|
+
import { Logging } from '@newrelic/browser-agent/features/logging';
|
|
177
|
+
import { Metrics } from '@newrelic/browser-agent/features/metrics';
|
|
178
|
+
import { PageViewEvent } from '@newrelic/browser-agent/features/page_view_event';
|
|
179
|
+
import { PageViewTiming } from '@newrelic/browser-agent/features/page_view_timing';
|
|
180
|
+
import { SessionReplay } from '@newrelic/browser-agent/features/session_replay';
|
|
181
|
+
import { SessionTrace } from '@newrelic/browser-agent/features/session_trace';
|
|
182
|
+
import { SoftNav } from '@newrelic/browser-agent/features/soft_navigations';
|
|
183
|
+
import { Spa } from '@newrelic/browser-agent/features/spa';
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Example 1 - "Page Load Agent"
|
|
121
187
|
The example below includes three feature modules: `Metrics`, `PageViewEvent`, and `PageViewTiming`.
|
|
122
188
|
|
|
123
189
|
```javascript
|
|
@@ -142,17 +208,39 @@ new Agent({
|
|
|
142
208
|
})
|
|
143
209
|
```
|
|
144
210
|
|
|
145
|
-
|
|
211
|
+
### Example 2: "Custom Events Agent"
|
|
212
|
+
The example below builds an agent that only allows custom events (`.recordCustomEvent(...)`) and does not automatically detect any other event types besides a PageView event (required). It also [disables the automatic collection of certain generic events](#disabling-individual-generic-events) to ensure only manual events are captured.
|
|
146
213
|
|
|
147
214
|
```javascript
|
|
148
|
-
import {
|
|
149
|
-
import { JSErrors } from '@newrelic/browser-agent/features/jserrors';
|
|
150
|
-
import { Metrics } from '@newrelic/browser-agent/features/metrics';
|
|
215
|
+
import { Agent } from '@newrelic/browser-agent/loaders/agent'
|
|
151
216
|
import { GenericEvents } from '@newrelic/browser-agent/features/generic_events';
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
217
|
+
|
|
218
|
+
const options = {
|
|
219
|
+
info: { ... },
|
|
220
|
+
loader_config: { ... },
|
|
221
|
+
init: {
|
|
222
|
+
// disable the automatic collection of UserAction events
|
|
223
|
+
user_actions: {enabled: false},
|
|
224
|
+
// disable the automatic collection of BrowserPerformance events
|
|
225
|
+
performance: {
|
|
226
|
+
capture_marks: false,
|
|
227
|
+
capture_measures: false,
|
|
228
|
+
resources: {enabled: false}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const browserAgent = new Agent({
|
|
234
|
+
...options,
|
|
235
|
+
features: [
|
|
236
|
+
GenericEvents
|
|
237
|
+
]
|
|
238
|
+
})
|
|
239
|
+
|
|
240
|
+
// manually capture page actions
|
|
241
|
+
browserAgent.addPageAction(...)
|
|
242
|
+
// manually capture custom events
|
|
243
|
+
browserAgent.recordCustomEvent(...)
|
|
156
244
|
```
|
|
157
245
|
|
|
158
246
|
## Deploying one or more "micro" agents per page
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.292.
|
|
20
|
+
const VERSION = exports.VERSION = "1.292.1-rc.1";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.292.
|
|
20
|
+
const VERSION = exports.VERSION = "1.292.1-rc.1";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -30,9 +30,10 @@ function setupAgentSession(agentRef) {
|
|
|
30
30
|
// Retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s), if any was stored.
|
|
31
31
|
const customSessionData = agentRef.runtime.session.state.custom;
|
|
32
32
|
if (customSessionData) {
|
|
33
|
+
/** stored attributes from previous page should not take precedence over attributes stored on this page via API before the page load */
|
|
33
34
|
agentRef.info.jsAttributes = {
|
|
34
|
-
...
|
|
35
|
-
...
|
|
35
|
+
...customSessionData,
|
|
36
|
+
...agentRef.info.jsAttributes
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
const sharedEE = _contextualEe.ee.get(agentRef.agentIdentifier);
|
|
@@ -23,9 +23,10 @@ export function setupAgentSession(agentRef) {
|
|
|
23
23
|
// Retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s), if any was stored.
|
|
24
24
|
const customSessionData = agentRef.runtime.session.state.custom;
|
|
25
25
|
if (customSessionData) {
|
|
26
|
+
/** stored attributes from previous page should not take precedence over attributes stored on this page via API before the page load */
|
|
26
27
|
agentRef.info.jsAttributes = {
|
|
27
|
-
...
|
|
28
|
-
...
|
|
28
|
+
...customSessionData,
|
|
29
|
+
...agentRef.info.jsAttributes
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
const sharedEE = ee.get(agentRef.agentIdentifier);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAWA,
|
|
1
|
+
{"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAWA,sDAuCC"}
|
package/package.json
CHANGED
|
@@ -25,7 +25,8 @@ export function setupAgentSession (agentRef) {
|
|
|
25
25
|
// Retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s), if any was stored.
|
|
26
26
|
const customSessionData = agentRef.runtime.session.state.custom
|
|
27
27
|
if (customSessionData) {
|
|
28
|
-
|
|
28
|
+
/** stored attributes from previous page should not take precedence over attributes stored on this page via API before the page load */
|
|
29
|
+
agentRef.info.jsAttributes = { ...customSessionData, ...agentRef.info.jsAttributes }
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
const sharedEE = ee.get(agentRef.agentIdentifier)
|