This guide is for maintainers who build and publish Office Viewer. End users should read the Usage data section in README.md or README-CN.md.
| Item | Value |
|---|---|
| SDK | @vscode/extension-telemetry |
| Backend | Azure Application Insights (Workspace-based) |
| Code | src/service/telemetryService.ts |
| Event inventory | telemetry.json (root) |
Telemetry is disabled until you set a non-empty connection string in telemetryService.ts.
- Open https://portal.azure.com
- Sign in with a Microsoft account (personal or work). A free Azure account is enough for an extension with moderate traffic.
Application Insights (workspace-based) needs a Log Analytics workspace.
- Portal search: Log Analytics workspaces → Create
- Choose subscription, resource group, name, and region (pick one close to you, e.g. East Asia)
- Review + create
You can skip this if you already have a workspace.
-
Portal search: Application Insights → Create
-
Basics
- Name: e.g.
vscode-office-telemetry - Region: same as workspace when possible
- Resource mode: Workspace-based
- Workspace: select the workspace from above
- Name: e.g.
-
Review + create → wait for deployment
-
Open the new resource → left menu Configure → Connection string
-
Copy the full string, for example:
InstrumentationKey=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;IngestionEndpoint=https://eastasia-1.in.applicationinsights.azure.com/;LiveEndpoint=https://eastasia.livediagnostics.monitor.azure.com/;ApplicationId=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Microsoft documents the connection string as not sensitive; it is commonly committed in extension source. It only allows sending telemetry, not reading it.
-
Open
src/service/telemetryService.ts -
Paste your connection string:
const TELEMETRY_CONNECTION_STRING = 'InstrumentationKey=...;IngestionEndpoint=...';
-
Rebuild and package:
yarn build yarn package
-
Install the
.vsixlocally and open a supported file (e.g..xlsx) once -
In Azure Portal → your Application Insights → Logs, run:
customEvents | where timestamp > ago(30m) | where name == "view.open" | project timestamp, name, customDimensions | order by timestamp desc
Events may take 2–5 minutes to appear the first time.
customEvents
| where name == "view.open"
| extend viewType = tostring(customDimensions.viewType)
| extend fileType = tostring(customDimensions.fileType)
| summarize count() by viewType, fileType
| order by count_ descUses Application Insights anonymous user_Id (not PII).
customEvents
| where name == "view.open"
| summarize DAU = dcount(user_Id) by bin(timestamp, 1d)
| order by timestamp desccustomEvents
| where name == "view.open"
| extend viewType = tostring(customDimensions.viewType)
| summarize count() by viewType, appVersion
| order by count_ desc- Application Insights bills on ingested data volume
- This extension sends small, infrequent events; typical usage stays within the free monthly allowance for personal/small extensions
- Monitor Usage and estimated costs in the Azure Portal if traffic grows
| Control | Setting |
|---|---|
| VS Code global | telemetry.telemetryLevel / telemetry.enableTelemetry |
| Extension only | vscode-office.enableTelemetry (default: true) |
@vscode/extension-telemetry checks env.isTelemetryEnabled before sending.
After building the extension, you can inspect declared events:
code --telemetry > /tmp/vscode-telemetry.jsonIf telemetry.json is packaged with the extension, Office Viewer events appear in that report.
| Problem | Check |
|---|---|
| No events in Logs | Connection string set and non-empty? Rebuilt after change? Wait a few minutes |
| Still no events | VS Code telemetry off? vscode-office.enableTelemetry false? |
| Events in dev only | Published VSIX built after adding the connection string |
| Query empty filter | Use ago(24h) or wider time range in Logs |
src/service/telemetryService.ts— reporter and event APIsrc/service/officeViewType.ts—viewType/fileTypemappingsrc/provider/officeViewerProvider.ts— office preview eventstelemetry.json— event metadata for transparency