https://github.com/threadheap/vscode-extension-analytics
Telemetry and analytics client for VSCode extensions with customisable transports
https://github.com/threadheap/vscode-extension-analytics
Last synced: 4 months ago
JSON representation
Telemetry and analytics client for VSCode extensions with customisable transports
- Host: GitHub
- URL: https://github.com/threadheap/vscode-extension-analytics
- Owner: threadheap
- License: other
- Created: 2019-07-06T06:19:04.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T03:46:48.000Z (over 3 years ago)
- Last Synced: 2025-08-27T10:49:40.993Z (10 months ago)
- Language: JavaScript
- Size: 486 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [vscode-extension-analytics](https://www.npmjs.com/package/vscode-extension-analytics)
This module provides a consistent way for first-party extensions to report analytics and telemetry
with different analytics providers. The module respects the user's decision about whether or
not to send telemetry data.
This module mostly a fork of [vscode-extension-telemetry](https://github.com/Microsoft/vscode-extension-telemetry)
# install
`npm install vscode-extension-analytics`
# usage
```javascript
const vscode = require('vscode');
const {AnalyticsProvider, AnalyticsEvent} = require('vscode-extension-analytics');
// all events will be prefixed with this event name
const extensionId = '';
// extension version will be reported as a property with each event
const extensionVersion = '';
// see analytics interface in src/base-client.ts
const client = new AnalyticsClient();
// telemetry reporter
let analyticsProvider;
function activate(context: vscode.ExtensionContext) {
...
// create analytics provider on extension activation
analyticsProvider = new AnalyticsProvider(extensionId, extensionVersion, client, options);
// ensure it gets property disposed
context.subscriptions.push(analyticsProvider);
...
}
function deactivate() {
// This will ensure all pending events get flushed
analyticsProvider.dispose();
}
...
// send event any time after activation
analyticsProvider.sendEvent(new AnalyticsEvent('opened', {attribute: 'value'}));
```
# common properties
- `common.extname`
- `common.extversion`
- `common.vscodemachineid`
- `common.vscodesessionid`
- `common.vscodeversion`
- `common.os`
- `common.platformversion`
# License
[MIT](LICENSE)