Skip to content

Commit

Permalink
add journey events for plan, onboarding, import and test apis
Browse files Browse the repository at this point in the history
  • Loading branch information
ankush-jain-akto committed Apr 16, 2024
1 parent 418d070 commit c6dc0b5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ function Billing() {
cancelUrl: window.location.href
});

if (window?.Intercom) {
window.Intercom("trackEvent", "clicked-upgrade", {"intention": intentionType, "installation": "saas"})
}

console.log("checkoutResult", checkoutResult);
if (checkoutResult.data.provisionSubscription.status === 'PAYMENT_REQUIRED') {
window.location.href = checkoutResult.data.provisionSubscription.checkoutUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ const PlanDetails = ({customerId}) => {
cancelUrl: window.location.href+"?orgId="+orgId
});

if (window?.Intercom) {
window.Intercom("trackEvent", "clicked-upgrade", {"intention": intentionType, "installation": "self-hosted"})
}


console.log("checkoutResult", checkoutResult);
if (checkoutResult.data.provisionSubscription.status === 'PAYMENT_REQUIRED') {
window.location.href = checkoutResult.data.provisionSubscription.checkoutUrl;
Expand Down
27 changes: 26 additions & 1 deletion apps/dashboard/web/polaris_web/web/src/util/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,33 @@ service.interceptors.response.use((response) => {
return response.data
}, err)

const black_list_apis = ['dashboard/accesstoken', 'api/fetchBurpPluginInfo', 'api/fetchActiveLoaders', 'api/fetchAllSubCategories']
const black_list_apis = ['dashboard/accessToken', 'api/fetchBurpPluginInfo', 'api/fetchActiveLoaders', 'api/fetchAllSubCategories']
async function raiseMixpanelEvent(api) {
if (window?.Intercom) {
if (api?.startsWith("api/ingestPostman")) {
window.Intercom("trackEvent", "created-api-collection", {"type": "Postman"})
}

if (api?.startsWith("api/importSwaggerLogs")) {
window.Intercom("trackEvent", "created-api-collection", {"type": "Swagger"})
}

if (api?.startsWith("api/uploadHar")) {
window.Intercom("trackEvent", "created-api-collection", {"type": "Har"})
}

if (api?.startsWith("api/startTest")) {
window.Intercom("trackEvent", "started-test")
}

if (api?.startsWith("api/runTestForGivenTemplate")) {
window.Intercom("trackEvent", "tested-editor")
}

if (api?.startsWith("api/skipOnboarding") || api?.startsWith("api/fetchTestSuites")) {
window.Intercom("trackEvent", "onboarding-started")
}
}
if (api && !black_list_apis.some(black_list_api => api.includes(black_list_api))) {
window.mixpanel.track(api)
}
Expand Down

0 comments on commit c6dc0b5

Please sign in to comment.