Skip to content

Analysis: Web snippet does not send user agent context#2713

Closed
Copilot wants to merge 1 commit into
mainfrom
copilot/check-user-agent-context
Closed

Analysis: Web snippet does not send user agent context#2713
Copilot wants to merge 1 commit into
mainfrom
copilot/check-user-agent-context

Conversation

Copilot AI commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Investigation into whether the web snippet (shim) sends any user agent context with its telemetry envelopes.

Findings

The snippet does not include user agent in any telemetry it sends. Both envelope paths omit it:

  • AI envelopes (aiSupport.ts): Sets ai.device.id, ai.device.type, ai.operation.name, ai.internal.sdkVersion — no ai.user.userAgent
  • OneDS envelopes (1dsSupport.ts): Sets timezone (ext.loc.tz) and locale (ext.user.locale) — no user agent

The snippet does read navigator.userAgent already for IE detection in snippet.ts:

function isIE() {
    let nav = navigator;
    if (nav) {
        let userAgent = (nav.userAgent || "").toLowerCase();
        return (userAgent.indexOf("msie") !== -1 || userAgent.indexOf("trident/") !== -1);
    }
    return false;
}

The ai.user.userAgent tag key exists in ContextTagKeys and is used in the OTel span conversion path (spanUtils.ts), but the standard SDK telemetry pipeline via PropertiesPlugin also does not populate it — it only logs navigator.userAgent for internal diagnostics.

No code changes

This PR is investigation-only. If user agent context should be added to snippet envelopes, the changes would be in aiSupport.ts (add to tags["ai.user.userAgent"]) and 1dsSupport.ts (add to ext.device.userAgent in _addUser()).


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Investigate shim for user agent context transmission Analysis: Web snippet does not send user agent context Mar 6, 2026
@harsimar

harsimar commented Mar 6, 2026

Copy link
Copy Markdown
Member

Did not want to make this pr, closing.

@harsimar harsimar closed this Mar 6, 2026
@github-actions github-actions Bot deleted the copilot/check-user-agent-context branch March 8, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants