Skip to content

Commit

Permalink
Merge pull request #443 from HubSpot/add/vscode-usage-tracking-ep
Browse files Browse the repository at this point in the history
Add new vs code endpoint
  • Loading branch information
anthmatic authored Feb 22, 2021
2 parents 3e4dae6 + ca1f2f2 commit 4e27bc0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion packages/cli-lib/api/fileMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,28 @@ async function trackUsage(eventName, eventClass, meta = {}, accountId) {
eventClass,
meta,
};
const path = `${FILE_MAPPER_API_PATH}/cms-cli-usage`;
const EVENT_TYPES = {
VSCODE_EXTENSION_INTERACTION: 'vscode-extension-interaction',
CLI_INTERACTION: 'cli-interaction',
};

let analyticsEndpoint;

switch (eventName) {
case EVENT_TYPES.CLI_INTERACTION:
analyticsEndpoint = 'cms-cli-usage';
break;
case EVENT_TYPES.VSCODE_EXTENSION_INTERACTION:
analyticsEndpoint = 'vscode-extension-usage';
break;
default:
logger.debug(
`Usage tracking event '${eventName}' is not a valid event type.`
);
}

const path = `${FILE_MAPPER_API_PATH}/${analyticsEndpoint}`;

const accountConfig = accountId && getAccountConfig(accountId);

if (accountConfig && accountConfig.authType === 'personalaccesskey') {
Expand Down

0 comments on commit 4e27bc0

Please sign in to comment.