How to use the analytics.logEvent function in analytics

To help you get started, we’ve selected a few analytics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperstart / hyperstart.io / src / editor / runProject.ts View on Github external
actions._setState({
          compilationOutput: {
            success: false,
            loading: false,
            compiledModules
          }
        })
        throw "Compilation error(s)!"
      }
      const indexHtml = getFile(state, "/index.html")

      if (!indexHtml) {
        throw new Error("No index.html found in files")
      }

      logEvent(debug ? "debug" : "run", {
        event_category: "project",
        event_label: debug ? "DebugProject" : "RunProject"
      })

      const iframeSource = indexHtml.content
        .replace(
          ``,
          ``
        )
        .replace(
          ``,
          `<style>body { background-color: white; }</style>`
        ) // 

      actions._setState({
        compilationOutput: {
github hyperstart / hyperstart.io / src / editor / module.ts View on Github external
saveProject: () =&gt; (state, actions): Promise =&gt; {
      checkOpen(state)
      if (state.status === "read-only") {
        throw new Error(`Status should not be read-only.`)
      }
      if (state.status === "editing") {
        let toSave = state.project
        if (toSave.details !== state.original.details) {
          logEvent("rename_project", {
            event_category: "project",
            event_label: "Rename"
          })
          const name = normalize(toSave.details.name)
          toSave = {
            details: {
              ...toSave.details,
              name,
              hidden: name === "",
              searches: getSearches(name)
            },
            files: toSave.files
          }
        }
        return actions._projects.save(toSave).then(project =&gt; {
          // TODO recompute searches and stuff
github hyperstart / hyperstart.io / src / lib / search / module.ts View on Github external
.then(results => {
            logEvent("search", {
              event_category: "project",
              event_label: "Search"
            })
            const hasNext = results.length > search.resultsPerPage
            actions.update({ name, status: "success", results, hasNext })
            return actions.getState()[name]
          })
          .catch(e => {
github hyperstart / hyperstart.io / src / users / module.ts View on Github external
.then(() => {
                logEvent("login", {
                  event_category: "users",
                  event_label: eventLabel
                })

                onUserChanged(auth.currentUser, null)
                resolve()
              })
              .catch(e => {
github hyperstart / hyperstart.io / src / editor / ui / module.ts View on Github external
openEmbedModal: () => {
      logEvent("screen_view", { screen_name: "Embed modal" })
      return { embedModal: true }
    },
    closeEmbedModal: () => {
github hyperstart / hyperstart.io / src / forkProject.ts View on Github external
actions.users.getCurrentUser().then(user => {
      const owner = getProjectOwner(user)
      const newProject = copyProject(project, owner)
      actions.editor.open(newProject)
      replace("/projects/" + newProject.details.id)

      logEvent("fork_project", {
        event_category: "project",
        event_label: "Fork"
      })
    })
  )
github hyperstart / hyperstart.io / src / users / module.ts View on Github external
.then(() => {
              actions.hideSignUpModal()
              logEvent("signup", {
                event_category: "users",
                event_label: "SignupEmail"
              })

              onUserChanged(auth.currentUser, null)
              resolve()
            })
            .catch(e => {
github hyperstart / hyperstart.io / src / createProject.ts View on Github external
.then(project => {
        actions.editor.open(project)
        replace("/projects/" + project.details.id)
        logEvent("create_project", {
          event_category: "project",
          event_label: "Create" + template + "ProjectFromIndex"
        })
      })
  )
github hyperstart / hyperstart.io / src / editor / module.ts View on Github external
.then(project => {
          actions._setState({
            project,
            original: project,
            status: "editing"
          })
          replace(`/projects/${project.details.id}`)

          logEvent("fork_project", {
            event_category: "project",
            event_label: "Fork"
          })
        })
    },
github hyperstart / hyperstart.io / src / editor / debug / module.ts View on Github external
showPane: (paneShown: boolean) => {
      if (paneShown == true) {
        logEvent("debug", {
          event_category: "project",
          event_label: "ToggleDebug"
        })
      }
      return { paneShown }
    },
    setValueDisplay: (valueDisplay: api.ValueDisplay) => {