Skip to content

Commit 4efd3d2

Browse files
authored
Fix javascript snippet injection doc (#14333)
1 parent 3f88460 commit 4efd3d2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/advanced-configuration-options.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@ this option if your application relies on security manager to run untrusted code
3939

4040
## JavaScript snippet injection
4141

42-
This experimental feature allows you to inject JavaScript code into HTML responses from servlet applications. The agent will look for the `</head>` tag in HTML responses, and inject the configured JavaScript snippet before the closing `</head>` tag.
42+
This experimental feature allows you to inject JavaScript code into HTML responses from servlet applications. The agent will look for the `<head>` tag in HTML responses, and inject the configured JavaScript snippet after it.
4343

4444
This feature is designed for integrating client-side monitoring.
4545
We plan to integrate OpenTelemetry's own client-side monitoring solution by default once it's available
4646
(see the [browser instrumentation proposal](https://github.com/open-telemetry/community/blob/main/projects/browser-phase-1.md)).
4747

48-
| System property | Environment variable | Purpose |
49-
|--------------------------------------|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
50-
| otel.experimental.javascript-snippet | OTEL_EXPERIMENTAL_JAVASCRIPT_SNIPPET | JavaScript code to inject into HTML responses before the closing `</head>` tag. The value should be a complete JavaScript snippet including `<script>` tags if needed, e.g. `-Dotel.experimental.javascript-snippet="<script>console.log('Hello world!');</script>"` |
48+
| System property | Environment variable | Purpose |
49+
|--------------------------------------|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
50+
| otel.experimental.javascript-snippet | OTEL_EXPERIMENTAL_JAVASCRIPT_SNIPPET | Experimental setting to inject a JavaScript snippet into HTML responses after the opening `<head>` tag. The value should be a complete JavaScript snippet including `<script>` tags if needed, e.g. `-Dotel.experimental.javascript-snippet="<script>console.log('Hello world!');</script>"` |
5151

5252
**Important notes:**
5353

5454
- This only works with servlet-based applications currently
55-
- The snippet is injected only into HTML responses that contain a `</head>` tag
55+
- The snippet is injected only into HTML responses that contain a `<head>` tag
5656
- The agent will attempt to preserve the original character encoding of the response
5757
- If the response already has a `Content-Length` header, it will be updated to reflect the additional content

0 commit comments

Comments
 (0)