From de5ba3cdf2a3caef3fcb90201fe6f3b782ae8f3d Mon Sep 17 00:00:00 2001 From: Rahul Gupta Date: Fri, 7 Jun 2024 08:32:15 -0700 Subject: [PATCH] add posthog via import --- package-lock.json | 24 ++++++++++++++++++++++++ package.json | 5 +++-- src/editor/index.js | 6 ++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 38a664025..21f17e529 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "date-fns": "^2.30.0", "firebase": "^9.23.0", "lodash-es": "^4.17.21", + "posthog-js": "^1.138.1", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -15051,6 +15052,11 @@ "integrity": "sha512-3yurQZ2hD9VISAhJJP9bpYFNQrHHBXE2JxxjY5aLEcDi46RmAzJE2OC9FAde0yis5ElW0jTTzs0zfg/Cca4XqQ==", "dev": true }, + "node_modules/fflate": { + "version": "0.4.8", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.4.8.tgz", + "integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA==" + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -23799,6 +23805,24 @@ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" } }, + "node_modules/posthog-js": { + "version": "1.138.1", + "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.138.1.tgz", + "integrity": "sha512-hLahTznM0/iSM3vl6QGcmdG/zgCcW2DaQqPf7OtXCoqxNdYCWTNp6/sqepd6CxtDmJfm1S5Cbu1tD9TSksOYcA==", + "dependencies": { + "fflate": "^0.4.8", + "preact": "^10.19.3" + } + }, + "node_modules/preact": { + "version": "10.22.0", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.22.0.tgz", + "integrity": "sha512-RRurnSjJPj4rp5K6XoP45Ui33ncb7e4H7WiOHVpjbkvqvA3U+N8Z6Qbo0AE6leGYBV66n8EhEaFixvIu3SkxFw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", diff --git a/package.json b/package.json index 83746824c..0c18cc212 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "date-fns": "^2.30.0", "firebase": "^9.23.0", "lodash-es": "^4.17.21", + "posthog-js": "^1.138.1", "prop-types": "^15.8.1", "react": "^18.2.0", "react-dom": "^18.2.0", @@ -58,8 +59,8 @@ "approvals": "^7.1.0", "babel-loader": "^9.1.3", "copy-webpack-plugin": "^12.0.2", - "css-loader": "^6.10.0", "cross-env": "^7.0.3", + "css-loader": "^6.10.0", "css-minimizer-webpack-plugin": "^6.0.0", "dotenv-webpack": "^8.0.1", "eslint": "^8.57.0", @@ -105,4 +106,4 @@ "eslint" ] } -} \ No newline at end of file +} diff --git a/src/editor/index.js b/src/editor/index.js index abe99e3a3..01497049b 100644 --- a/src/editor/index.js +++ b/src/editor/index.js @@ -11,6 +11,7 @@ import { Viewport } from './lib/viewport'; import { firebaseConfig } from './services/firebase.js'; import './style/index.scss'; import ReactGA from 'react-ga4'; +import posthog from 'posthog-js'; function Inspector() { this.assetsLoader = new AssetsLoader(); @@ -329,4 +330,9 @@ Inspector.prototype = { ReactGA.initialize(firebaseConfig.measurementId); const inspector = (AFRAME.INSPECTOR = new Inspector()); +posthog.init('phc_Yclai3qykyFi8AEFOrZsh6aS78SSooLzpDz9wQ9YAH9', { + api_host: 'https://us.i.posthog.com', + person_profiles: 'identified_only' // or 'always' to create profiles for anonymous users as well +}); + export { inspector };