From ddb58631572deee66dd68436dcb962d6d68537b3 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 15:29:58 -0400 Subject: [PATCH 01/12] GA4 Updates --- src/components/GrowerStatsProfile/MyStats.js | 27 +++++++++++-------- .../utilities/GoogleAnalyticsGuide.md | 16 +++++------ src/utilities/error-analytics.js | 4 +++ 3 files changed, 28 insertions(+), 19 deletions(-) rename GoogleAnalyticsGuide.md => src/utilities/GoogleAnalyticsGuide.md (72%) diff --git a/src/components/GrowerStatsProfile/MyStats.js b/src/components/GrowerStatsProfile/MyStats.js index 10e3c4ff..eefb9be6 100644 --- a/src/components/GrowerStatsProfile/MyStats.js +++ b/src/components/GrowerStatsProfile/MyStats.js @@ -10,6 +10,7 @@ import Spinner from '../Spinner'; import useGrowerData from '../../utilities/useGrowerDataHook'; import { toast } from 'react-hot-toast'; import { Link } from 'react-router-dom'; +import { trackUserEvent, trackError, GA_ACTIONS, GA_CATEGORIES } from '../../utilities/error-analytics'; const MyStats = () => { const { user, growerId, setGrowerId } = useContext(UserContext); @@ -18,20 +19,24 @@ const MyStats = () => { const handleEdit = () => { setEditingGrowerId(true); + trackUserEvent(GA_ACTIONS.EDIT_GROWER_ID, GA_CATEGORIES.MY_STATS); }; const handleSave = (newGrowerId) => { - updateDoc(doc(db, 'Users', user.uid), { - growerId: newGrowerId - }).then(() => { - setGrowerId(newGrowerId); // Update growerId in context - setEditingGrowerId(false); // Exit editing mode - toast.success('Grower ID confirmed!'); // Add this line to show a success toast - }).catch(error => { - console.error('Error updating document:', error); // Keep this log to record potential errors - toast.error('Error confirming Grower ID.'); // Add this line to show an error toast - }); - }; + updateDoc(doc(db, 'Users', user.uid), { + growerId: newGrowerId + }).then(() => { + setGrowerId(newGrowerId); // Update growerId in context + setEditingGrowerId(false); // Exit editing mode + toast.success('Grower ID confirmed!'); // Show a success toast + trackUserEvent(GA_ACTIONS.CONFIRM_GROWER_ID, GA_CATEGORIES.MY_STATS); // Track successful update + }).catch(error => { + console.error('Error updating document:', error); // Keep this log to record potential errors + toast.error('Error confirming Grower ID.'); // Show an error toast + trackError(error.message, GA_CATEGORIES.MY_STATS, 'MyStats', GA_ACTIONS.CONFIRM_GROWER_ID); // Track error + }); +}; + if (loading) { return ; diff --git a/GoogleAnalyticsGuide.md b/src/utilities/GoogleAnalyticsGuide.md similarity index 72% rename from GoogleAnalyticsGuide.md rename to src/utilities/GoogleAnalyticsGuide.md index 3b4a9252..925fa0c8 100644 --- a/GoogleAnalyticsGuide.md +++ b/src/utilities/GoogleAnalyticsGuide.md @@ -1,26 +1,26 @@ # Implementation Guide: Adding Google Analytics 4 (GA4) to New Components in PumpkinPal -## Step 0: Update GA Actions and Categories (Preparation) +## Step 0: Update GA ACTIONS and CATEGORIES (Preparation) -Before implementing GA in a new component, update the `GA_Actions` and `GA_Categories` in `error-analytics.js` to include new actions or categories specific to the component. +Before implementing GA in a new component, update the `GA_ACTIONS` and `GA_CATEGORIES` in `error-analytics.js` to include new actions or categories specific to the component. ```javascript // In error-analytics.js -export const GA_Actions = { +export const GA_ACTIONS = { // ...existing actions NEW_ACTION: 'new_action', }; -export const GA_Categories = { +export const GA_CATEGORIES = { // ...existing categories NEW_CATEGORY: 'New Category', }; ``` ## Step 1: Import the Utility Functions and Constants -Import the utility functions trackUserEvent and trackError, as well as GA_Actions and GA_Categories, into the component where you want to add GA4 tracking. +Import the utility functions trackUserEvent and trackError, as well as GA_ACTIONS and GA_CATEGORIES, into the component where you want to add GA4 tracking. ```javascript -import { trackUserEvent, trackError, GA_Actions, GA_Categories } from '../utilities/error-analytics'; +import { trackUserEvent, trackError, GA_ACTIONS, GA_CATEGORIES } from '../utilities/error-analytics'; ``` ## Step 2: Identify User Events to Track Determine which user events in the component you want to track. @@ -31,7 +31,7 @@ Use the trackUserEvent function and the imported constants to track the identifi ```javascript const handleButtonClick = () => { // Your code here - trackUserEvent(GA_Actions.NEW_ACTION, GA_Categories.NEW_CATEGORY); + trackUserEvent(GA_ACTIONS.NEW_ACTION, GA_CATEGORIES.NEW_CATEGORY); }; ``` ## Step 4: Identify Errors to Track @@ -45,7 +45,7 @@ const fetchData = async () => { try { // Your code here } catch (error) { - trackError(error.message, GA_Categories.NEW_CATEGORY, 'ComponentName', GA_Actions.NEW_ACTION); + trackError(error.message, GA_CATEGORIES.NEW_CATEGORY, 'ComponentName', GA_ACTIONS.NEW_ACTION); } }; ``` diff --git a/src/utilities/error-analytics.js b/src/utilities/error-analytics.js index c5abbf26..a2809aad 100644 --- a/src/utilities/error-analytics.js +++ b/src/utilities/error-analytics.js @@ -3,6 +3,7 @@ import ReactGA from 'react-ga4'; export const GA_CATEGORIES = { USER: "User", SYSTEM: "System", + MY_STATS: 'My Stats', }; export const GA_ACTIONS = { @@ -19,6 +20,9 @@ export const GA_ACTIONS = { DELETE_ACCOUNT: "Delete Account", UPDATE_PREFERENCES: "Update Preferences", EXPORT_DATA: "Export Data", + EDIT_GROWER_ID: 'edit_grower_id', + CONFIRM_GROWER_ID: 'confirm_grower_id', + NAVIGATE_PUMPKIN_DETAILS: 'navigate_pumpkin_details', }; From 44715f018dfff7ff3f612144392f883df7f903c5 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 15:42:16 -0400 Subject: [PATCH 02/12] Update error-analytics.js --- src/utilities/error-analytics.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utilities/error-analytics.js b/src/utilities/error-analytics.js index a2809aad..efcba181 100644 --- a/src/utilities/error-analytics.js +++ b/src/utilities/error-analytics.js @@ -4,6 +4,7 @@ export const GA_CATEGORIES = { USER: "User", SYSTEM: "System", MY_STATS: 'My Stats', + SEARCH: 'Search', }; export const GA_ACTIONS = { @@ -23,6 +24,8 @@ export const GA_ACTIONS = { EDIT_GROWER_ID: 'edit_grower_id', CONFIRM_GROWER_ID: 'confirm_grower_id', NAVIGATE_PUMPKIN_DETAILS: 'navigate_pumpkin_details', + PERFORM_SEARCH: 'perform_search', + SEARCH_CLICK: 'search_click', }; From c6aa7e9d81d4206321ec727a208a2587522d1854 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 15:42:17 -0400 Subject: [PATCH 03/12] Update Search.js --- src/components/GrowerStatsProfile/Search.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/GrowerStatsProfile/Search.js b/src/components/GrowerStatsProfile/Search.js index 5d79ba38..26a8f242 100644 --- a/src/components/GrowerStatsProfile/Search.js +++ b/src/components/GrowerStatsProfile/Search.js @@ -3,6 +3,8 @@ import algoliasearch from 'algoliasearch/lite'; import { InstantSearch, SearchBox, Hits } from 'react-instantsearch'; import { useNavigate, useLocation } from 'react-router-dom'; import { GrowerContext } from '../../contexts/GrowerContext'; +import { trackUserEvent, trackError, GA_ACTIONS, GA_CATEGORIES } from '../../utilities/error-analytics'; + const searchClient = algoliasearch('SPV52PLJT9', process.env.REACT_APP_ALGOLIA_API_KEY); @@ -12,7 +14,9 @@ const Hit = ({ hit }) => { const location = useLocation(); // Import useLocation const handleHitClick = () => { + trackUserEvent(GA_ACTIONS.SEARCH_CLICK, GA_CATEGORIES.SEARCH); const collectionType = hit.path.split('/')[0]; + switch (collectionType) { case 'Stats_Growers': @@ -28,8 +32,10 @@ const Hit = ({ hit }) => { navigate(`/site-profile/${encodeURIComponent(hit.objectID)}`); break; default: - console.error('Unknown collection type:', collectionType); - break; + const errorMsg = 'Unknown collection type: ' + collectionType; + console.error(errorMsg); + trackError(errorMsg, GA_CATEGORIES.SEARCH, 'Search', GA_ACTIONS.SEARCH_CLICK); + break; } }; @@ -58,7 +64,9 @@ const Hit = ({ hit }) => { ); default: - console.error('Unknown collection type:', collectionType); + const errorMsg = 'Unknown collection type: ' + collectionType; + console.error(errorMsg); + trackError(errorMsg, GA_CATEGORIES.SEARCH, 'Search', GA_ACTIONS.SEARCH_CLICK); break; } }; @@ -75,6 +83,9 @@ const Hit = ({ hit }) => { const NoIcon = () => null; const Search = () => { + const handleSearch = () => { + trackUserEvent(GA_ACTIONS.PERFORM_SEARCH, GA_CATEGORIES.SEARCH); + }; return (
From 07ff9b0bfcb6b4ba009858947516de00026d66b4 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 15:52:56 -0400 Subject: [PATCH 04/12] Update ImageCard.js --- src/components/ImageCard.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/components/ImageCard.js b/src/components/ImageCard.js index 77a93978..c05753fa 100644 --- a/src/components/ImageCard.js +++ b/src/components/ImageCard.js @@ -11,6 +11,7 @@ import Button from '../utilities/Button'; import Spinner from '../components/Spinner'; import { deleteObject } from 'firebase/storage'; import { differenceInDays } from 'date-fns'; +import { trackUserEvent, trackError, GA_ACTIONS, GA_CATEGORIES } from '../../utilities/error-analytics'; const ImageCard = ({ pumpkinId, pumpkinName }) => { const [images, setImages] = useState([]); @@ -110,14 +111,17 @@ const calculateDaysAfterPollination = async (pumpkinId, shareDate) => { // Open the Facebook share dialog FB.ui(shareContent, function(response) { - if (response && !response.error_message) { - toast.success('Image shared successfully.'); - } else { - toast.error('Failed to share image. Please try again.'); - } - }); + if (response && !response.error_message) { + trackUserEvent(GA_ACTIONS.Share_Success, GA_CATEGORIES.ImageCard); + toast.success('Image shared successfully.'); + } else { + trackError('Failed to share image', GA_CATEGORIES.ImageCard, 'handleShare', GA_ACTIONS.Share_Failure); + toast.error('Failed to share image. Please try again.'); + } + }); } catch (e) { // If there's an error, dismiss the loading toast and show an error toast + trackError('Failed to create sharable link', GA_CATEGORIES.ImageCard, 'handleShare', GA_ACTIONS.Share_Failure); toast.dismiss(toastId); toast.error('Failed to create sharable link. Please try again.'); } @@ -160,7 +164,9 @@ const calculateDaysAfterPollination = async (pumpkinId, shareDate) => { // Revoke the blob URL to free up resources URL.revokeObjectURL(blobURL); - } catch (error) { + trackUserEvent(GA_ACTIONS.Download_Success, GA_CATEGORIES.ImageCard); + } catch (error) { + trackError('Failed to download image', GA_CATEGORIES.ImageCard, 'handleDownload', GA_ACTIONS.Download_Failure); console.error('Error downloading image:', error); toast.error('Failed to download image. Please try again.'); } @@ -194,7 +200,9 @@ const calculateDaysAfterPollination = async (pumpkinId, shareDate) => { // Show a success toast toast.success('Image deleted successfully.'); - } catch (error) { + trackUserEvent(GA_ACTIONS.Delete_Success, GA_CATEGORIES.ImageCard); + } catch (error) { + trackError('Failed to delete image', GA_CATEGORIES.ImageCard, 'handleDelete', GA_ACTIONS.Delete_Failure); console.error('Error deleting image:', error); toast.error('Failed to delete image. Please try again.'); } From 482ac81d6e253383fd46f1ee03bf35d2a47b66a3 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 15:52:58 -0400 Subject: [PATCH 05/12] Update error-analytics.js --- src/utilities/error-analytics.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utilities/error-analytics.js b/src/utilities/error-analytics.js index efcba181..73270af0 100644 --- a/src/utilities/error-analytics.js +++ b/src/utilities/error-analytics.js @@ -5,6 +5,7 @@ export const GA_CATEGORIES = { SYSTEM: "System", MY_STATS: 'My Stats', SEARCH: 'Search', + IMAGE_CARD: 'ImageCard', }; export const GA_ACTIONS = { @@ -26,6 +27,12 @@ export const GA_ACTIONS = { NAVIGATE_PUMPKIN_DETAILS: 'navigate_pumpkin_details', PERFORM_SEARCH: 'perform_search', SEARCH_CLICK: 'search_click', + DOWNLOAD_SUCCESS: 'Download_Success', + DOWNLOAD_FAILURE: 'Download_Failure', + SHARE_SUCCESS: 'Share_Success', + SHARE_FAILURE: 'Share_Failure', + DELETE_SUCCESS: 'Delete_Success', + DELETE_FAILURE: 'Delete_Failure', }; From 64caa45b3935a28e2d5729107588bc59c336ae93 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 15:57:03 -0400 Subject: [PATCH 06/12] Update ImageCard.js --- src/components/ImageCard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/ImageCard.js b/src/components/ImageCard.js index c05753fa..fdddc6ac 100644 --- a/src/components/ImageCard.js +++ b/src/components/ImageCard.js @@ -11,7 +11,7 @@ import Button from '../utilities/Button'; import Spinner from '../components/Spinner'; import { deleteObject } from 'firebase/storage'; import { differenceInDays } from 'date-fns'; -import { trackUserEvent, trackError, GA_ACTIONS, GA_CATEGORIES } from '../../utilities/error-analytics'; +import { trackUserEvent, trackError, GA_ACTIONS, GA_CATEGORIES } from '../utilities/error-analytics'; const ImageCard = ({ pumpkinId, pumpkinName }) => { const [images, setImages] = useState([]); From 995d88a10bf3bd2badd021cef00e505f0e4d805a Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 16:07:18 -0400 Subject: [PATCH 07/12] Update GrowerSearch.js --- .../GrowerStatsProfile/GrowerSearch.js | 35 ++++++++++++------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/src/components/GrowerStatsProfile/GrowerSearch.js b/src/components/GrowerStatsProfile/GrowerSearch.js index 95dda206..856c1db2 100644 --- a/src/components/GrowerStatsProfile/GrowerSearch.js +++ b/src/components/GrowerStatsProfile/GrowerSearch.js @@ -3,6 +3,8 @@ import getGrowerSuggestions from '../../utilities/getGrowerSuggestions'; import fetchPumpkins from '../../utilities/fetchPumpkins'; import { toast } from 'react-hot-toast'; import TableSection from './TableSection'; +import { trackUserEvent, trackError, GA_ACTIONS, GA_CATEGORIES } from '../../utilities/error-analytics'; + // Function to convert a string to title case function toTitleCase(str) { @@ -39,34 +41,43 @@ const GrowerSearch = ({ user, handleSave }) => { const [state, dispatch] = useReducer(reducer, initialState); useEffect(() => { - if (state.growerName) { - getGrowerSuggestions(toTitleCase(state.growerName), (error, suggestions) => { - if (error) { - toast.error('Error fetching grower suggestions: ' + error.message); - } else { - dispatch({ type: 'SET_SUGGESTIONS', payload: suggestions }); - } - }); - } - }, [state.growerName]); + if (state.growerName) { + // Track the search initiation event + trackUserEvent(GA_ACTIONS.Search_Initiated, GA_CATEGORIES.GrowerSearch); + + getGrowerSuggestions(toTitleCase(state.growerName), (error, suggestions) => { + if (error) { + // Track the error event + trackError(error.message, 'getGrowerSuggestions', GA_CATEGORIES.GrowerSearch, GA_ACTIONS.Fetch_Suggestions_Failure); + toast.error('Error fetching grower suggestions: ' + error.message); + } else { + // Track the successful fetch event + trackUserEvent(GA_ACTIONS.Fetch_Suggestions_Success, GA_CATEGORIES.GrowerSearch); + dispatch({ type: 'SET_SUGGESTIONS', payload: suggestions }); + } +}); + } +}, [state.growerName]); useEffect(() => { if (state.selectedGrower && state.selectedGrower.id) { fetchPumpkins(state.selectedGrower.id) .then((pumpkins) => { - dispatch({ type: 'SET_PUMPKIN_PREVIEW', payload: pumpkins }); + trackUserEvent(GA_ACTIONS.Pumpkin_Data_Fetched, GA_CATEGORIES.GrowerSearch); }) .catch((error) => { - toast.error('Error fetching pumpkins: ' + error.message); + trackError(error, 'fetchPumpkins', GA_CATEGORIES.GrowerSearch, GA_ACTIONS.Pumpkin_Data_Error); }); } }, [state.selectedGrower]); const handleSelectGrower = (grower) => { + trackUserEvent(GA_ACTIONS.Grower_Selected, GA_CATEGORIES.GrowerSearch); dispatch({ type: 'SET_SELECTED_GROWER', payload: grower }); }; const handleConfirm = () => { + trackUserEvent(GA_ACTIONS.Grower_Confirmed, GA_CATEGORIES.GrowerSearch); console.log('handleConfirm called. user.uid:', user.uid, 'state.selectedGrower.id:', state.selectedGrower.id); console.log('handleConfirm', user.uid, state.selectedGrower.id); handleSave(state.selectedGrower.id); // Call handleSave from MyStats From c41662ae77379e9c5dcb60dfa6aa274d80604b82 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 16:07:19 -0400 Subject: [PATCH 08/12] Update error-analytics.js --- src/utilities/error-analytics.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/utilities/error-analytics.js b/src/utilities/error-analytics.js index 73270af0..b6bd9fe9 100644 --- a/src/utilities/error-analytics.js +++ b/src/utilities/error-analytics.js @@ -6,6 +6,7 @@ export const GA_CATEGORIES = { MY_STATS: 'My Stats', SEARCH: 'Search', IMAGE_CARD: 'ImageCard', + GrowerSearch: 'GrowerSearch', }; export const GA_ACTIONS = { @@ -33,6 +34,13 @@ export const GA_ACTIONS = { SHARE_FAILURE: 'Share_Failure', DELETE_SUCCESS: 'Delete_Success', DELETE_FAILURE: 'Delete_Failure', + Search_Initiated: 'Search_Initiated', + Fetch_Suggestions_Success: 'Fetch_Suggestions_Success', + Fetch_Suggestions_Failure: 'Fetch_Suggestions_Failure', + Pumpkin_Data_Fetched: 'Pumpkin_Data_Fetched', + Pumpkin_Data_Error: 'Pumpkin_Data_Error', + Grower_Selected: 'Grower_Selected', + Grower_Confirmed: 'Grower_Confirmed', }; From eb19d4fd5b90b7b33c7fc93b1055187a909dc78d Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 16:11:14 -0400 Subject: [PATCH 09/12] Update Search.js --- src/components/GrowerStatsProfile/Search.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/components/GrowerStatsProfile/Search.js b/src/components/GrowerStatsProfile/Search.js index 26a8f242..41fe53cd 100644 --- a/src/components/GrowerStatsProfile/Search.js +++ b/src/components/GrowerStatsProfile/Search.js @@ -83,9 +83,6 @@ const Hit = ({ hit }) => { const NoIcon = () => null; const Search = () => { - const handleSearch = () => { - trackUserEvent(GA_ACTIONS.PERFORM_SEARCH, GA_CATEGORIES.SEARCH); - }; return (
From 73fdcd40ba66cc76116ce7a75d447c57d1d42b21 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 16:13:04 -0400 Subject: [PATCH 10/12] Update Search.js --- src/components/GrowerStatsProfile/Search.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/GrowerStatsProfile/Search.js b/src/components/GrowerStatsProfile/Search.js index 41fe53cd..cb24d32b 100644 --- a/src/components/GrowerStatsProfile/Search.js +++ b/src/components/GrowerStatsProfile/Search.js @@ -83,11 +83,16 @@ const Hit = ({ hit }) => { const NoIcon = () => null; const Search = () => { + const handleSearch = (event) => { + trackUserEvent(GA_ACTIONS.PERFORM_SEARCH, GA_CATEGORIES.SEARCH); + }; + return (
Date: Sat, 26 Aug 2023 16:22:40 -0400 Subject: [PATCH 11/12] Update GrowerSearch.js --- .../GrowerStatsProfile/GrowerSearch.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/GrowerStatsProfile/GrowerSearch.js b/src/components/GrowerStatsProfile/GrowerSearch.js index 856c1db2..a1067f16 100644 --- a/src/components/GrowerStatsProfile/GrowerSearch.js +++ b/src/components/GrowerStatsProfile/GrowerSearch.js @@ -60,16 +60,18 @@ const GrowerSearch = ({ user, handleSave }) => { }, [state.growerName]); useEffect(() => { - if (state.selectedGrower && state.selectedGrower.id) { - fetchPumpkins(state.selectedGrower.id) - .then((pumpkins) => { - trackUserEvent(GA_ACTIONS.Pumpkin_Data_Fetched, GA_CATEGORIES.GrowerSearch); - }) - .catch((error) => { - trackError(error, 'fetchPumpkins', GA_CATEGORIES.GrowerSearch, GA_ACTIONS.Pumpkin_Data_Error); - }); - } - }, [state.selectedGrower]); + if (state.selectedGrower && state.selectedGrower.id) { + fetchPumpkins(state.selectedGrower.id) + .then((pumpkins) => { + trackUserEvent(GA_ACTIONS.Pumpkin_Data_Fetched, GA_CATEGORIES.GrowerSearch); + dispatch({ type: 'SET_PUMPKIN_PREVIEW', payload: pumpkins }); + }) + .catch((error) => { + trackError(error, 'fetchPumpkins', GA_CATEGORIES.GrowerSearch, GA_ACTIONS.Pumpkin_Data_Error); + }); + } +}, [state.selectedGrower]); + const handleSelectGrower = (grower) => { trackUserEvent(GA_ACTIONS.Grower_Selected, GA_CATEGORIES.GrowerSearch); From 93e0f7f4307fb4873e79580d96feebb2992f71f4 Mon Sep 17 00:00:00 2001 From: ryanmio Date: Sat, 26 Aug 2023 16:24:54 -0400 Subject: [PATCH 12/12] Update error-analytics.js --- src/utilities/error-analytics.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/utilities/error-analytics.js b/src/utilities/error-analytics.js index b6bd9fe9..c008b2dd 100644 --- a/src/utilities/error-analytics.js +++ b/src/utilities/error-analytics.js @@ -50,6 +50,8 @@ export function trackError(error, method, category = GA_CATEGORIES.SYSTEM, actio category: category, action: action, label: `${method} - ${error.code || "Unknown error"}: ${error.message || ""}`, + dimensions: { + 'dimension1': process.env.NODE_ENV // 'development' or 'production' }); }