From c72fdb81af4fb893039a672cbb2055a72abf5ddd Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 31 Oct 2022 11:27:33 -0700 Subject: [PATCH 1/2] Improved LR tracking. --- client/src/App/App.jsx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index ccd22f414..2d183c595 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -1,4 +1,4 @@ -import { useTreatments } from "@splitsoftware/splitio-react"; +import { useClient } from "@splitsoftware/splitio-react"; import { Button, Result } from "antd"; import LogRocket from "logrocket"; import React, { lazy, Suspense, useEffect } from "react"; @@ -51,11 +51,7 @@ export function App({ online, setOnline, }) { - const { LogRocket_Tracking } = useTreatments( - ["LogRocket_Tracking"], - {}, - bodyshop && bodyshop.imexshopid - ); + const client = useClient(); useEffect(() => { if (!navigator.onLine) { @@ -78,15 +74,15 @@ export function App({ setOnline(true); }); useEffect(() => { - if (currentUser.authorized) { - if ( - process.env.NODE_ENV === "production" && - LogRocket_Tracking.treatment === "on" - ) { + if (currentUser.authorized && bodyshop) { + console.log("Setting Attribute"); + client.setAttribute("imexshopid", bodyshop.imexshopid); + if (client.getTreatmentWithConfig("LogRocket_Tracking")) { + console.log("LR Start"); LogRocket.init("gvfvfw/bodyshopapp"); } } - }, [currentUser.authorized, LogRocket_Tracking.treatment]); + }, [bodyshop, client, currentUser.authorized]); if (currentUser.authorized === null) { return ; From 790fd4611f4356538fa048b67a6a9fa5e63f7e26 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Mon, 31 Oct 2022 11:30:45 -0700 Subject: [PATCH 2/2] Improved LR activiation. --- client/src/App/App.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 2d183c595..618366db4 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -75,9 +75,9 @@ export function App({ }); useEffect(() => { if (currentUser.authorized && bodyshop) { - console.log("Setting Attribute"); client.setAttribute("imexshopid", bodyshop.imexshopid); - if (client.getTreatmentWithConfig("LogRocket_Tracking")) { + + if (client.getTreatment("LogRocket_Tracking") === "on") { console.log("LR Start"); LogRocket.init("gvfvfw/bodyshopapp"); }