How to use posthog-js - 2 common examples

To help you get started, we’ve selected a few posthog-js 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 porter-dev / porter / dashboard / src / main / home / provisioner / ProvisionerStatus.tsx View on Github external
let d = JSON.parse(msg["Values"]["data"]);

          if (d["kind"] == "error") {
            err = d["log"];
            break;
          }

          // add only valid events
          if (d["log"] != null && d["created_resources"] != null && d["total_resources"] != null) {
            validEvents.push(d);
          }
        }
      }

      if (err) {
        posthog.capture('Provisioning Error', {error: err});

        let e = ansiparse(err).map((el: any) => {
          return el.text;
        })

        let index = this.state.infras.findIndex(el => el.kind === infra.kind)
        infra.status = "error"
        let infras = this.state.infras
        infras[index] = infra
        this.setState({ logs: [...this.state.logs, ...e], error: true, infras });
        return;
      }

      if (validEvents.length == 0) {
        return;
      }
github porter-dev / porter / dashboard / src / main / home / provisioner / ProvisionerStatus.tsx View on Github external
for (let i = 0; i < infras.length; i++) {
      if (!this.state.maxStep[infras[i].kind]) {
        skip = true;
      }
    }

    if (!skip) {
      for (let key in this.state.maxStep) {
        maxStep += this.state.maxStep[key]
        currentStep += this.state.currentStep[key]
      }  
    }

    if (maxStep !== 0 && currentStep === maxStep && !triggerEnd) {
      posthog.capture('Provisioning complete!')
      this.onEnd()
      this.setState({ triggerEnd: true });
    }

    return (
      
        {error ? (
          <>
            
              <title>
                &lt;img src={warning} /&gt; Provisioning Error
              </title>
            

            
              Porter encountered an error while provisioning.

posthog-js

Posthog-js allows you to automatically capture usage and send events to PostHog.

MIT
Latest version published 2 days ago

Package Health Score

83 / 100
Full package analysis

Popular posthog-js functions

Similar packages