feat: add analytics logging while hoppscotch requests are fired

This commit is contained in:
Andrew Bastin
2021-07-05 20:02:29 -04:00
parent 913b073ba4
commit 86bd4aa568
8 changed files with 70 additions and 2 deletions

View File

@@ -485,9 +485,10 @@
import * as gql from "graphql"
import { commonHeaders } from "~/helpers/headers"
import { getPlatformSpecialKey } from "~/helpers/platformutils"
import { sendNetworkRequest } from "~/helpers/network"
import { getCurrentStrategyID, sendNetworkRequest } from "~/helpers/network"
import { getSettingSubject } from "~/newstore/settings"
import { addGraphqlHistoryEntry } from "~/newstore/history"
import { logHoppRequestRunToAnalytics } from "~/helpers/fb/analytics"
export default {
beforeRouteLeave(_to, _from, next) {
@@ -849,6 +850,11 @@ export default {
})
console.log("Error", error)
}
logHoppRequestRunToAnalytics({
platform: "graphql-query",
strategy: getCurrentStrategyID(),
})
},
// NOTE : schema required here is the GQL Schema document object, not the schema string
@@ -918,6 +924,11 @@ export default {
await this.getSchema()
this.pollSchema()
logHoppRequestRunToAnalytics({
platform: "graphql-schema",
strategy: getCurrentStrategyID(),
})
}
},
async pollSchema() {