diff --git a/client/.env.development.imex b/client/.env.development.imex
index d1383e6ef..0b2eec83e 100644
--- a/client/.env.development.imex
+++ b/client/.env.development.imex
@@ -14,3 +14,5 @@ VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
VITE_APP_INSTANCE=IMEX
TEST_USERNAME="test@imex.dev"
TEST_PASSWORD="test123"
+VITE_PUBLIC_POSTHOG_KEY=phc_xtLmBIu0rjWwExY73Oj5DTH1bGbwq1G1Y8jnlTceien
+VITE_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
\ No newline at end of file
diff --git a/client/.env.development.rome b/client/.env.development.rome
index 15408c90b..fb4690ff6 100644
--- a/client/.env.development.rome
+++ b/client/.env.development.rome
@@ -16,3 +16,5 @@ VITE_APP_COUNTRY=USA
VITE_APP_INSTANCE=ROME
TEST_USERNAME="test@imex.dev"
TEST_PASSWORD="test123"
+VITE_PUBLIC_POSTHOG_KEY=phc_xtLmBIu0rjWwExY73Oj5DTH1bGbwq1G1Y8jnlTceien
+VITE_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
\ No newline at end of file
diff --git a/client/.env.production.imex b/client/.env.production.imex
index 22754aadf..eaa7f6c56 100644
--- a/client/.env.production.imex
+++ b/client/.env.production.imex
@@ -13,3 +13,5 @@ VITE_APP_AXIOS_BASE_API_URL=https://api.imex.online/
VITE_APP_REPORTS_SERVER_URL=https://reports.imex.online
VITE_APP_SPLIT_API=et9pjkik6bn67he5evpmpr1agoo7gactphgk
VITE_APP_INSTANCE=IMEX
+VITE_PUBLIC_POSTHOG_KEY=phc_xtLmBIu0rjWwExY73Oj5DTH1bGbwq1G1Y8jnlTceien
+VITE_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
\ No newline at end of file
diff --git a/client/.env.production.rome b/client/.env.production.rome
index 8647660c2..64b33ade8 100644
--- a/client/.env.production.rome
+++ b/client/.env.production.rome
@@ -13,3 +13,5 @@ VITE_APP_AXIOS_BASE_API_URL=https://api.romeonline.io/
VITE_APP_REPORTS_SERVER_URL=https://reports.romeonline.io
VITE_APP_SPLIT_API=et9pjkik6bn67he5evpmpr1agoo7gactphgk
VITE_APP_INSTANCE=ROME
+VITE_PUBLIC_POSTHOG_KEY=phc_xtLmBIu0rjWwExY73Oj5DTH1bGbwq1G1Y8jnlTceien
+VITE_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
\ No newline at end of file
diff --git a/client/.env.test.imex b/client/.env.test.imex
index 84167c4cb..5071568c5 100644
--- a/client/.env.test.imex
+++ b/client/.env.test.imex
@@ -13,3 +13,5 @@ VITE_APP_REPORTS_SERVER_URL=https://reports.test.imex.online
VITE_APP_IS_TEST=true
VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
VITE_APP_INSTANCE=IMEX
+VITE_PUBLIC_POSTHOG_KEY=phc_xtLmBIu0rjWwExY73Oj5DTH1bGbwq1G1Y8jnlTceien
+VITE_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
\ No newline at end of file
diff --git a/client/.env.test.rome b/client/.env.test.rome
index bce8f4cd3..708647c14 100644
--- a/client/.env.test.rome
+++ b/client/.env.test.rome
@@ -13,3 +13,5 @@ VITE_APP_REPORTS_SERVER_URL=https://reports.test.romeonline.io
VITE_APP_IS_TEST=true
VITE_APP_SPLIT_API=ts615lqgnmk84thn72uk18uu5pgce6e0l4rc
VITE_APP_INSTANCE=ROME
+VITE_PUBLIC_POSTHOG_KEY=phc_xtLmBIu0rjWwExY73Oj5DTH1bGbwq1G1Y8jnlTceien
+VITE_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com
\ No newline at end of file
diff --git a/client/package-lock.json b/client/package-lock.json
index 882f993e0..2ec3d13e4 100644
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@ -50,6 +50,7 @@
"normalize-url": "^8.0.2",
"object-hash": "^3.0.0",
"phone": "^3.1.67",
+ "posthog-js": "^1.260.2",
"prop-types": "^15.8.1",
"query-string": "^9.2.2",
"raf-schd": "^4.0.3",
@@ -9068,6 +9069,12 @@
}
}
},
+ "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==",
+ "license": "MIT"
+ },
"node_modules/file-entry-cache": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
@@ -13144,6 +13151,57 @@
"integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
"license": "MIT"
},
+ "node_modules/posthog-js": {
+ "version": "1.260.2",
+ "resolved": "https://registry.npmjs.org/posthog-js/-/posthog-js-1.260.2.tgz",
+ "integrity": "sha512-2Q+QUz9j9+uG16wp0WcOEbezVsLZCobZyTX8NvWPMGKyPaf2lOsjbPjznsq5JiIt324B6NAqzpWYZTzvhn9k9Q==",
+ "license": "SEE LICENSE IN LICENSE",
+ "dependencies": {
+ "core-js": "^3.38.1",
+ "fflate": "^0.4.8",
+ "preact": "^10.19.3",
+ "web-vitals": "^4.2.4"
+ },
+ "peerDependencies": {
+ "@rrweb/types": "2.0.0-alpha.17",
+ "rrweb-snapshot": "2.0.0-alpha.17"
+ },
+ "peerDependenciesMeta": {
+ "@rrweb/types": {
+ "optional": true
+ },
+ "rrweb-snapshot": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/posthog-js/node_modules/core-js": {
+ "version": "3.45.1",
+ "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.45.1.tgz",
+ "integrity": "sha512-L4NPsJlCfZsPeXukyzHFlg/i7IIVwHSItR0wg0FLNqYClJ4MQYTYLbC7EkjKYRLZF2iof2MUgN0EGy7MdQFChg==",
+ "hasInstallScript": true,
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/core-js"
+ }
+ },
+ "node_modules/posthog-js/node_modules/web-vitals": {
+ "version": "4.2.4",
+ "resolved": "https://registry.npmjs.org/web-vitals/-/web-vitals-4.2.4.tgz",
+ "integrity": "sha512-r4DIlprAGwJ7YM11VZp4R884m0Vmgr6EAKe3P+kO0PPj3Unqyvv59rczf6UiGcb9Z8QxZVcqKNwv/g0WNdWwsw==",
+ "license": "Apache-2.0"
+ },
+ "node_modules/preact": {
+ "version": "10.27.1",
+ "resolved": "https://registry.npmjs.org/preact/-/preact-10.27.1.tgz",
+ "integrity": "sha512-V79raXEWch/rbqoNc7nT9E4ep7lu+mI3+sBmfRD4i1M73R3WLYcCtdI0ibxGVf4eQL8ZIz2nFacqEC+rmnOORQ==",
+ "license": "MIT",
+ "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/client/package.json b/client/package.json
index c4bf85455..73f192767 100644
--- a/client/package.json
+++ b/client/package.json
@@ -49,6 +49,7 @@
"normalize-url": "^8.0.2",
"object-hash": "^3.0.0",
"phone": "^3.1.67",
+ "posthog-js": "^1.260.2",
"prop-types": "^15.8.1",
"query-string": "^9.2.2",
"raf-schd": "^4.0.3",
diff --git a/client/src/firebase/firebase.utils.js b/client/src/firebase/firebase.utils.js
index 61f279692..9d8d44b65 100644
--- a/client/src/firebase/firebase.utils.js
+++ b/client/src/firebase/firebase.utils.js
@@ -5,6 +5,7 @@ import { getFirestore } from "@firebase/firestore";
import { getMessaging, getToken, onMessage } from "@firebase/messaging";
import { store } from "../redux/store";
import * as amplitude from '@amplitude/analytics-browser';
+import posthog from 'posthog-js'
const config = JSON.parse(import.meta.env.VITE_APP_FIREBASE_CONFIG);
initializeApp(config);
@@ -96,6 +97,8 @@ export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
// );
logEvent(analytics, eventName, eventParams);
amplitude.track(eventName, eventParams);
+ posthog.capture(eventName, eventParams);
+
} finally {
//If it fails, just keep going.
}
diff --git a/client/src/index.jsx b/client/src/index.jsx
index 23d32134d..3c41b9f5b 100644
--- a/client/src/index.jsx
+++ b/client/src/index.jsx
@@ -15,6 +15,8 @@ import reportWebVitals from "./reportWebVitals";
import "./translations/i18n";
import "./utils/CleanAxios";
import * as amplitude from "@amplitude/analytics-browser";
+import { PostHogProvider } from "posthog-js/react";
+
window.global ||= window;
registerSW({ immediate: true });
@@ -37,7 +39,12 @@ function App() {
return (
} persistor={persistor}>
-
+
+
+
);
diff --git a/client/src/redux/user/user.sagas.js b/client/src/redux/user/user.sagas.js
index 3159d18f6..e6c81e92e 100644
--- a/client/src/redux/user/user.sagas.js
+++ b/client/src/redux/user/user.sagas.js
@@ -50,6 +50,7 @@ import {
} from "./user.actions";
import UserActionTypes from "./user.types";
import * as amplitude from '@amplitude/analytics-browser';
+import posthog from 'posthog-js';
const fpPromise = FingerprintJS.load();
@@ -91,7 +92,8 @@ export function* isUserAuthenticated() {
}
LogRocket.identify(user.email);
- amplitude.setUserId(user.email)
+ amplitude.setUserId(user.email);
+ posthog.identify(user.email);
const eulaQuery = yield client.query({
query: QUERY_EULA,
@@ -363,6 +365,7 @@ export function* SetAuthLevelFromShopDetails({ payload }) {
try {
amplitude.setGroup('Shop', payload.shopname);
+ posthog.group
window.$crisp.push(["set", "user:company", [payload.shopname]]);
if (authRecord[0] && authRecord[0].user.validemail) {
window.$crisp.push(["set", "user:email", [authRecord[0].user.email]]);