IO-1367 Open Replay Tracking Improvements

This commit is contained in:
Patrick Fic
2021-09-20 12:16:37 -07:00
parent d5f3105341
commit 59e994ac29
3 changed files with 16 additions and 5 deletions

View File

@@ -11,7 +11,8 @@ import App from "./App";
import trackerGraphQL from "@openreplay/tracker-graphql";
//import trackerRedux from "@openreplay/tracker-redux";
import Tracker from "@openreplay/tracker";
//import trackerAssist from "@openreplay/tracker-assist";
import trackerAssist from "@openreplay/tracker-assist";
import { getCurrentUser } from "../firebase/firebase.utils";
moment.locale("en-US");
export const tracker = new Tracker({
@@ -21,12 +22,16 @@ export const tracker = new Tracker({
? { __DISABLE_SECURE_MODE: true }
: {}),
// beaconSize: 10485760,
onStart: ({ sessionID }) => console.log("ORS SESSION ", sessionID),
onStart: async ({ sessionID }) => {
const user = await getCurrentUser();
tracker.setUserID(user.email);
console.log("ORS SESSION ", sessionID, user.email);
},
});
// tracker.use(
// trackerAssist({ confirmText: "Technical support is about to assist you." })
// ); // check the list of available options below
tracker.use(
trackerAssist({ confirmText: "Technical support is about to assist you." })
); // check the list of available options below
export const recordGraphQL = tracker.use(trackerGraphQL());
tracker.start();
if (process.env.NODE_ENV === "production") LogRocket.init("gvfvfw/bodyshopapp");

View File

@@ -9,6 +9,7 @@ import {
selectBodyshop,
selectCurrentUser,
} from "../../redux/user/user.selectors";
import { tracker } from "../../App/App.container";
const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser,
@@ -36,6 +37,7 @@ class ErrorBoundary extends React.Component {
componentDidCatch(error, info) {
console.log("Exception Caught by Error Boundary.", error, info);
this.setState({ ...this.state, error, info });
tracker.event("error_boundary", error, true);
}
handleErrorSubmit = () => {

View File

@@ -2,6 +2,7 @@ import { getAnalytics, logEvent } from "firebase/analytics";
import { initializeApp } from "firebase/app";
import { getAuth, updatePassword, updateProfile } from "firebase/auth";
import { getFirestore } from "firebase/firestore";
import { tracker } from "../App/App.container";
//import { getMessaging } from "firebase/messaging";
import { store } from "../redux/store";
@@ -69,6 +70,9 @@ export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
eventParams
);
logEvent(analytics, eventName, eventParams);
//Log event to OpenReplay server.
tracker.event(eventName, eventParams);
};
// if (messaging) {