You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+96-8Lines changed: 96 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -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
+
constoptions= {
107
+
info: { ... },
108
+
loader_config: { ... },
109
+
init: {
110
+
page_action: {enabled:false}
111
+
...
112
+
}
113
+
}
114
+
```
115
+
116
+
#### User Actions
117
+
```javascript
118
+
constoptions= {
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
+
constoptions= {
131
+
info: { ... },
132
+
loader_config: { ... },
133
+
init: {
134
+
performance: {
135
+
capture_marks:false, // disable performance mark collection
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:
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
-
The following feature modules are available for inclusion in the `features` array:
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.
0 commit comments