mirror of
https://github.com/andrepimenta/claude-code-chat.git
synced 2026-05-30 00:05:44 +08:00
Add analytics tracking to MCP, skills, plugins, and checkout
Track modal opens, installs, removals with properties for MCP servers, skills, and plugins. Add checkout completed event and support attempted event. Include error details in install failures. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ const getPluginsScript = () => `
|
|||||||
}
|
}
|
||||||
|
|
||||||
function showPluginsModal() {
|
function showPluginsModal() {
|
||||||
|
sendStats('Plugins modal opened');
|
||||||
document.getElementById('pluginsModal').style.display = 'flex';
|
document.getElementById('pluginsModal').style.display = 'flex';
|
||||||
loadInstalledPlugins();
|
loadInstalledPlugins();
|
||||||
renderAvailablePlugins(topPlugins);
|
renderAvailablePlugins(topPlugins);
|
||||||
@@ -138,11 +139,13 @@ const getPluginsScript = () => `
|
|||||||
}
|
}
|
||||||
|
|
||||||
function installPlugin(installId) {
|
function installPlugin(installId) {
|
||||||
|
sendStats('Plugin installed', { plugin: installId });
|
||||||
vscode.postMessage({ type: 'installPlugin', installId: installId });
|
vscode.postMessage({ type: 'installPlugin', installId: installId });
|
||||||
hidePluginsModal();
|
hidePluginsModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
function removePlugin(installId) {
|
function removePlugin(installId) {
|
||||||
|
sendStats('Plugin removed', { plugin: installId });
|
||||||
vscode.postMessage({ type: 'removePlugin', installId: installId });
|
vscode.postMessage({ type: 'removePlugin', installId: installId });
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
onPurchaseCompleted: function(data) {
|
onPurchaseCompleted: function(data) {
|
||||||
|
sendStats('Checkout completed');
|
||||||
vscode.postMessage({
|
vscode.postMessage({
|
||||||
type: 'opencreditsKeyFromCheckout',
|
type: 'opencreditsKeyFromCheckout',
|
||||||
key: data.user_key
|
key: data.user_key
|
||||||
@@ -1336,6 +1337,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
|||||||
|
|
||||||
// Tools modal functions
|
// Tools modal functions
|
||||||
function showMCPModal() {
|
function showMCPModal() {
|
||||||
|
sendStats('MCP modal opened');
|
||||||
document.getElementById('mcpModal').style.display = 'flex';
|
document.getElementById('mcpModal').style.display = 'flex';
|
||||||
loadMCPServers();
|
loadMCPServers();
|
||||||
if (!marketplaceCache || marketplaceCache.length === 0) {
|
if (!marketplaceCache || marketplaceCache.length === 0) {
|
||||||
@@ -1468,8 +1470,6 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveMCPServer() {
|
function saveMCPServer() {
|
||||||
sendStats('MCP server added');
|
|
||||||
|
|
||||||
const name = document.getElementById('serverName').value.trim();
|
const name = document.getElementById('serverName').value.trim();
|
||||||
const type = document.getElementById('serverType').value;
|
const type = document.getElementById('serverType').value;
|
||||||
|
|
||||||
@@ -1553,6 +1553,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
|||||||
}
|
}
|
||||||
|
|
||||||
var scope = document.getElementById('serverScope') ? document.getElementById('serverScope').value : 'project';
|
var scope = document.getElementById('serverScope') ? document.getElementById('serverScope').value : 'project';
|
||||||
|
sendStats('MCP server added', { name: name });
|
||||||
vscode.postMessage({
|
vscode.postMessage({
|
||||||
type: 'saveMCPServer',
|
type: 'saveMCPServer',
|
||||||
name: name,
|
name: name,
|
||||||
@@ -1568,6 +1569,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
|||||||
}
|
}
|
||||||
|
|
||||||
function deleteMCPServer(serverName, scope) {
|
function deleteMCPServer(serverName, scope) {
|
||||||
|
sendStats('MCP server removed', { name: serverName });
|
||||||
vscode.postMessage({
|
vscode.postMessage({
|
||||||
type: 'deleteMCPServer',
|
type: 'deleteMCPServer',
|
||||||
name: serverName,
|
name: serverName,
|
||||||
@@ -1649,8 +1651,8 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sendStats('MCP server added');
|
sendStats('MCP server added', { name: name });
|
||||||
|
|
||||||
// Add the server
|
// Add the server
|
||||||
vscode.postMessage({
|
vscode.postMessage({
|
||||||
type: 'saveMCPServer',
|
type: 'saveMCPServer',
|
||||||
@@ -2844,7 +2846,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
|||||||
successEl.querySelector('.install-success-text').textContent = 'Installed';
|
successEl.querySelector('.install-success-text').textContent = 'Installed';
|
||||||
successEl.querySelector('.install-success-hint').textContent = 'Send a message to get started';
|
successEl.querySelector('.install-success-hint').textContent = 'Send a message to get started';
|
||||||
} else {
|
} else {
|
||||||
sendStats('Install failed');
|
sendStats('Install failed', { error: (error || 'Unknown error').substring(0, 200) });
|
||||||
// Show error state
|
// Show error state
|
||||||
successEl.querySelector('.install-success-icon').style.display = 'none';
|
successEl.querySelector('.install-success-icon').style.display = 'none';
|
||||||
successEl.querySelector('.install-success-text').textContent = 'Installation failed';
|
successEl.querySelector('.install-success-text').textContent = 'Installation failed';
|
||||||
@@ -4672,6 +4674,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
|||||||
var message = document.getElementById('supportMessage').value.trim();
|
var message = document.getElementById('supportMessage').value.trim();
|
||||||
if (!message) { return; }
|
if (!message) { return; }
|
||||||
|
|
||||||
|
sendStats('Support attempted', { type: type });
|
||||||
var btn = document.getElementById('supportSubmitBtn');
|
var btn = document.getElementById('supportSubmitBtn');
|
||||||
btn.textContent = 'Sending...';
|
btn.textContent = 'Sending...';
|
||||||
btn.disabled = true;
|
btn.disabled = true;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const getSkillsScript = () => `
|
|||||||
var topSkills = (window.__topSkills || []);
|
var topSkills = (window.__topSkills || []);
|
||||||
|
|
||||||
function showSkillsModal() {
|
function showSkillsModal() {
|
||||||
|
sendStats('Skills modal opened');
|
||||||
document.getElementById('skillsModal').style.display = 'flex';
|
document.getElementById('skillsModal').style.display = 'flex';
|
||||||
loadInstalledSkills();
|
loadInstalledSkills();
|
||||||
if (topSkills.length > 0) {
|
if (topSkills.length > 0) {
|
||||||
@@ -266,6 +267,7 @@ const getSkillsScript = () => `
|
|||||||
function confirmSkillInstall(btn) {
|
function confirmSkillInstall(btn) {
|
||||||
var source = btn.dataset.source;
|
var source = btn.dataset.source;
|
||||||
var name = btn.dataset.name;
|
var name = btn.dataset.name;
|
||||||
|
sendStats('Skill installed', { name: name, source: source });
|
||||||
var scope = document.getElementById('skillInstallScope').value;
|
var scope = document.getElementById('skillInstallScope').value;
|
||||||
|
|
||||||
var repoUrl = 'https://github.com/' + source.replace(/^github\\//, '');
|
var repoUrl = 'https://github.com/' + source.replace(/^github\\//, '');
|
||||||
|
|||||||
Reference in New Issue
Block a user