feat: introduce more events into the analytics pipeline (#3156)

This commit is contained in:
Andrew Bastin
2023-06-24 10:18:35 +05:30
parent 5650de1183
commit 355bd62b8d
22 changed files with 307 additions and 8 deletions

View File

@@ -324,7 +324,8 @@ const newSendRequest = async () => {
loading.value = true
// Log the request run into analytics
platform.analytics?.logHoppRequestRunToAnalytics({
platform.analytics?.logEvent({
type: "HOPP_REQUEST_RUN",
platform: "rest",
strategy: getCurrentStrategyID(),
})
@@ -446,6 +447,11 @@ const copyRequest = async () => {
shareLink.value = ""
fetchingShareLink.value = true
const shortcodeResult = await createShortcode(tab.value.document.request)()
platform.analytics?.logEvent({
type: "HOPP_SHORTCODE_CREATED",
})
if (E.isLeft(shortcodeResult)) {
toast.error(`${shortcodeResult.left.error}`)
shareLink.value = `${t("error.something_went_wrong")}`
@@ -516,6 +522,14 @@ const saveRequest = () => {
editRESTRequest(saveCtx.folderPath, saveCtx.requestIndex, req)
tab.value.document.isDirty = false
platform.analytics?.logEvent({
type: "HOPP_SAVE_REQUEST",
platform: "rest",
createdNow: false,
workspaceType: "personal",
})
toast.success(`${t("request.saved")}`)
} catch (e) {
tab.value.document.saveContext = undefined
@@ -526,6 +540,13 @@ const saveRequest = () => {
// TODO: handle error case (NOTE: overwriteRequestTeams is async)
try {
platform.analytics?.logEvent({
type: "HOPP_SAVE_REQUEST",
platform: "rest",
createdNow: false,
workspaceType: "team",
})
runMutation(UpdateRequestDocument, {
requestID: saveCtx.requestID,
data: {