Improved LR tracking.
This commit is contained in:
@@ -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 <LoadingSpinner message={t("general.labels.loggingin")} />;
|
||||
|
||||
Reference in New Issue
Block a user