Added google analytics tracking.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import * as Analytics from "expo-firebase-analytics";
|
||||
import * as firebase from "firebase/app";
|
||||
import "firebase/auth";
|
||||
import { store } from "../redux/store";
|
||||
|
||||
//const config = JSON.parse(process.env.REACT_APP_FIREBASE_CONFIG);
|
||||
// const config = {
|
||||
@@ -52,3 +54,25 @@ export const updateCurrentUser = (userDetails) => {
|
||||
}, reject);
|
||||
});
|
||||
};
|
||||
|
||||
export const logImEXEvent = (eventName, additionalParams, stateProp = null) => {
|
||||
const state = stateProp || store.getState();
|
||||
const eventParams = {
|
||||
shop:
|
||||
(state.user && state.user.bodyshop && state.user.bodyshop.shopname) ||
|
||||
null,
|
||||
user:
|
||||
(state.user && state.user.currentUser && state.user.currentUser.email) ||
|
||||
null,
|
||||
...additionalParams,
|
||||
};
|
||||
console.log(
|
||||
"%c[Analytics]",
|
||||
"background-color: green ;font-weight:bold;",
|
||||
eventName,
|
||||
eventParams
|
||||
);
|
||||
Analytics.logEvent(eventName, eventParams);
|
||||
};
|
||||
|
||||
//export const ExpoAnalytics = Analytics;
|
||||
|
||||
Reference in New Issue
Block a user