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() {
|
||||
sendStats('Plugins modal opened');
|
||||
document.getElementById('pluginsModal').style.display = 'flex';
|
||||
loadInstalledPlugins();
|
||||
renderAvailablePlugins(topPlugins);
|
||||
@@ -138,11 +139,13 @@ const getPluginsScript = () => `
|
||||
}
|
||||
|
||||
function installPlugin(installId) {
|
||||
sendStats('Plugin installed', { plugin: installId });
|
||||
vscode.postMessage({ type: 'installPlugin', installId: installId });
|
||||
hidePluginsModal();
|
||||
}
|
||||
|
||||
function removePlugin(installId) {
|
||||
sendStats('Plugin removed', { plugin: installId });
|
||||
vscode.postMessage({ type: 'removePlugin', installId: installId });
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -32,6 +32,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
||||
}
|
||||
},
|
||||
onPurchaseCompleted: function(data) {
|
||||
sendStats('Checkout completed');
|
||||
vscode.postMessage({
|
||||
type: 'opencreditsKeyFromCheckout',
|
||||
key: data.user_key
|
||||
@@ -1336,6 +1337,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
||||
|
||||
// Tools modal functions
|
||||
function showMCPModal() {
|
||||
sendStats('MCP modal opened');
|
||||
document.getElementById('mcpModal').style.display = 'flex';
|
||||
loadMCPServers();
|
||||
if (!marketplaceCache || marketplaceCache.length === 0) {
|
||||
@@ -1468,8 +1470,6 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
||||
}
|
||||
|
||||
function saveMCPServer() {
|
||||
sendStats('MCP server added');
|
||||
|
||||
const name = document.getElementById('serverName').value.trim();
|
||||
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';
|
||||
sendStats('MCP server added', { name: name });
|
||||
vscode.postMessage({
|
||||
type: 'saveMCPServer',
|
||||
name: name,
|
||||
@@ -1568,6 +1569,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
||||
}
|
||||
|
||||
function deleteMCPServer(serverName, scope) {
|
||||
sendStats('MCP server removed', { name: serverName });
|
||||
vscode.postMessage({
|
||||
type: 'deleteMCPServer',
|
||||
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
|
||||
vscode.postMessage({
|
||||
type: 'saveMCPServer',
|
||||
@@ -2844,7 +2846,7 @@ const getScript = (isTelemetryEnabled: boolean, opencreditsApiUrl: string = 'htt
|
||||
successEl.querySelector('.install-success-text').textContent = 'Installed';
|
||||
successEl.querySelector('.install-success-hint').textContent = 'Send a message to get started';
|
||||
} else {
|
||||
sendStats('Install failed');
|
||||
sendStats('Install failed', { error: (error || 'Unknown error').substring(0, 200) });
|
||||
// Show error state
|
||||
successEl.querySelector('.install-success-icon').style.display = 'none';
|
||||
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();
|
||||
if (!message) { return; }
|
||||
|
||||
sendStats('Support attempted', { type: type });
|
||||
var btn = document.getElementById('supportSubmitBtn');
|
||||
btn.textContent = 'Sending...';
|
||||
btn.disabled = true;
|
||||
|
||||
@@ -5,6 +5,7 @@ const getSkillsScript = () => `
|
||||
var topSkills = (window.__topSkills || []);
|
||||
|
||||
function showSkillsModal() {
|
||||
sendStats('Skills modal opened');
|
||||
document.getElementById('skillsModal').style.display = 'flex';
|
||||
loadInstalledSkills();
|
||||
if (topSkills.length > 0) {
|
||||
@@ -266,6 +267,7 @@ const getSkillsScript = () => `
|
||||
function confirmSkillInstall(btn) {
|
||||
var source = btn.dataset.source;
|
||||
var name = btn.dataset.name;
|
||||
sendStats('Skill installed', { name: name, source: source });
|
||||
var scope = document.getElementById('skillInstallScope').value;
|
||||
|
||||
var repoUrl = 'https://github.com/' + source.replace(/^github\\//, '');
|
||||
|
||||
Reference in New Issue
Block a user