From b0599fc9c479ee48ecd56a50e145968e274ec0d0 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 13 Jul 2020 17:12:54 +0100 Subject: [PATCH] posthog analytics --- .github/workflows/budibase_ci.yml | 3 +++ packages/builder/package.json | 2 +- packages/builder/rollup.config.js | 2 ++ packages/builder/src/builderStore/index.js | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 21d735fcbc..4719b2ad4a 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -29,6 +29,9 @@ jobs: - run: yarn lint - run: yarn bootstrap - run: yarn build + env: + POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }} + POSTHOG_URL: ${{ secrets.POSTHOG_URL }} - run: yarn test env: CI: true diff --git a/packages/builder/package.json b/packages/builder/package.json index 3a9e22e214..0064a62d47 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -64,9 +64,9 @@ "feather-icons": "^4.21.0", "flatpickr": "^4.5.7", "lodash": "^4.17.13", - "logrocket": "^1.0.6", "lunr": "^2.3.5", "mustache": "^4.0.1", + "posthog-js": "^1.3.1", "safe-buffer": "^5.1.2", "shortid": "^2.2.8", "string_decoder": "^1.2.0", diff --git a/packages/builder/rollup.config.js b/packages/builder/rollup.config.js index 575939ac19..c89a34c9f9 100644 --- a/packages/builder/rollup.config.js +++ b/packages/builder/rollup.config.js @@ -180,6 +180,8 @@ export default { "process.env.NODE_ENV": JSON.stringify( production ? "production" : "development" ), + "process.env.POSTHOG_TOKEN": process.env.POSTHOG_TOKEN, + "process.env.POSTHOG_URL": process.env.POSTHOG_URL, }), svelte({ diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index 2af3a66667..0cfedd1395 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -1,7 +1,7 @@ import { getStore } from "./store" import { getBackendUiStore } from "./store/backend" import { getWorkflowStore } from "./store/workflow/" -import LogRocket from "logrocket" +import posthog from "posthog-js"; export const store = getStore() export const backendUiStore = getBackendUiStore() @@ -10,7 +10,7 @@ export const workflowStore = getWorkflowStore() export const initialise = async () => { try { if (process.env.NODE_ENV === "production") { - LogRocket.init("knlald/budibase") + posthog.init(process.env.POSTHOG_TOKEN, { api_host: process.env.POSTHOG_URL }); } } catch (err) { console.log(err)