Oops!
diff --git a/frontend/web/components/pages/OrganisationIntegrationsPage.tsx b/frontend/web/components/pages/OrganisationIntegrationsPage.tsx
index 2c84655e6106..bc3641a6ea25 100644
--- a/frontend/web/components/pages/OrganisationIntegrationsPage.tsx
+++ b/frontend/web/components/pages/OrganisationIntegrationsPage.tsx
@@ -1,4 +1,4 @@
-import React, { useEffect } from 'react'
+import React from 'react'
import IntegrationList from 'components/IntegrationList'
import Constants from 'common/constants'
import PageTitle from 'components/PageTitle'
@@ -6,13 +6,8 @@ import Utils from 'common/utils/utils'
import AccountStore from 'common/stores/account-store'
import { OrganisationPermission } from 'common/types/permissions.types'
import { useHasPermission } from 'common/providers/Permission'
-import API from 'project/api'
const OrganisationIntegrationsPage = ({ match }) => {
- useEffect(() => {
- API.trackPage(Constants.pages.INTEGRATIONS)
- }, [])
-
const integrationData = Utils.getIntegrationData()
const allIntegrations = Object.keys(integrationData).sort((a, b) =>
(integrationData[a]?.title || a).localeCompare(
diff --git a/frontend/web/components/pages/PasswordResetPage.js b/frontend/web/components/pages/PasswordResetPage.js
index 09f8e390b7ed..12c63e387ece 100644
--- a/frontend/web/components/pages/PasswordResetPage.js
+++ b/frontend/web/components/pages/PasswordResetPage.js
@@ -1,5 +1,4 @@
import React, { Component } from 'react'
-import Constants from 'common/constants'
import ErrorMessage from 'components/ErrorMessage'
import { withRouter } from 'react-router-dom'
const PasswordResetPage = class extends Component {
@@ -10,10 +9,6 @@ const PasswordResetPage = class extends Component {
this.state = {}
}
- componentDidMount = () => {
- API.trackPage(Constants.pages.RESET_PASSWORD)
- }
-
onSave = () => {
this.props.history.replace('/login')
toast('Your password has been reset')
diff --git a/frontend/web/components/pages/SegmentsPage.tsx b/frontend/web/components/pages/SegmentsPage.tsx
index 2fe170b7b848..a35def6b7441 100644
--- a/frontend/web/components/pages/SegmentsPage.tsx
+++ b/frontend/web/components/pages/SegmentsPage.tsx
@@ -10,7 +10,6 @@ import {
useGetSegmentsQuery,
} from 'common/services/useSegment'
import { useHasPermission } from 'common/providers/Permission'
-import API from 'project/api'
import Button from 'components/base/forms/Button'
import Chip from 'components/base/Chip'
import CreateSegmentModal from 'components/modals/CreateSegment'
@@ -75,9 +74,6 @@ const SegmentsPage: FC = () => {
ProjectStore.getMaxSegmentsAllowed(),
)
- useEffect(() => {
- API.trackPage(Constants.pages.FEATURES)
- }, [])
useEffect(() => {
if (error) {
// Kick user back out to projects
diff --git a/frontend/web/components/pages/environment-settings/EnvironmentSettingsPage.tsx b/frontend/web/components/pages/environment-settings/EnvironmentSettingsPage.tsx
index 5cf3353f48ed..e4ee0cdc0a94 100644
--- a/frontend/web/components/pages/environment-settings/EnvironmentSettingsPage.tsx
+++ b/frontend/web/components/pages/environment-settings/EnvironmentSettingsPage.tsx
@@ -27,7 +27,6 @@ import AddMetadataToEntity from 'components/metadata/AddMetadataToEntity'
import { getSupportedContentType } from 'common/services/useSupportedContentType'
import Format from 'common/utils/format'
import Setting from 'components/Setting'
-import API from 'project/api'
import AppActions from 'common/dispatcher/app-actions'
import { Environment, Webhook, Role } from 'common/types/responses'
import PanelSearch from 'components/PanelSearch'
@@ -164,7 +163,6 @@ const EnvironmentSettingsPage: React.FC = () => {
}, [match.params.environmentId, getEnvironment])
useEffect(() => {
- API.trackPage(Constants.pages.ENVIRONMENT_SETTINGS)
getEnvironment()
}, [getEnvironment])
diff --git a/frontend/web/components/pages/feature-lifecycle/FeatureLifecyclePage.tsx b/frontend/web/components/pages/feature-lifecycle/FeatureLifecyclePage.tsx
index 7801ee5b1ad7..5ce27efff122 100644
--- a/frontend/web/components/pages/feature-lifecycle/FeatureLifecyclePage.tsx
+++ b/frontend/web/components/pages/feature-lifecycle/FeatureLifecyclePage.tsx
@@ -1,7 +1,6 @@
import React, { FC, useCallback, useMemo, useState } from 'react'
import { useParams } from 'react-router-dom'
import { useRouteContext } from 'components/providers/RouteContext'
-import { usePageTracking } from 'common/hooks/usePageTracking'
import { hasActiveFilters } from 'common/utils/featureFilterParams'
import PageTitle from 'components/PageTitle'
import Icon from 'components/icons/Icon'
@@ -97,15 +96,6 @@ const FeatureLifecyclePage: FC = () => {
section,
})
- usePageTracking({
- context: {
- organisationId: routeContext.organisationId,
- projectId: projectIdNum,
- },
- pageName: 'CLEANUP',
- saveToStorage: false,
- })
-
if (!environmentId) {
return (
diff --git a/frontend/web/components/pages/features/FeaturesPage.tsx b/frontend/web/components/pages/features/FeaturesPage.tsx
index 918f90b284ec..43afdfd0d680 100644
--- a/frontend/web/components/pages/features/FeaturesPage.tsx
+++ b/frontend/web/components/pages/features/FeaturesPage.tsx
@@ -2,13 +2,12 @@ import React, { FC, useCallback, useEffect, useMemo } from 'react'
import cloneDeep from 'lodash/cloneDeep'
import { useHistory } from 'react-router-dom'
import CreateFlagModal from 'components/modals/create-feature'
-import Constants from 'common/constants'
import Utils from 'common/utils/utils'
import AppActions from 'common/dispatcher/app-actions'
import FeatureListStore from 'common/stores/feature-list-store'
import { FEATURES_PAGE_SIZE } from 'common/services/useProjectFlag'
import { useRouteContext } from 'components/providers/RouteContext'
-import { usePageTracking } from 'common/hooks/usePageTracking'
+import { useSaveLastEnvironment } from 'common/hooks/useSaveLastEnvironment'
import FeatureRow from 'components/feature-summary/FeatureRow'
import FeatureRowSkeleton from 'components/feature-summary/FeatureRowSkeleton'
import JSONReference from 'components/JSONReference'
@@ -185,14 +184,10 @@ const FeaturesPage: FC = ({ forcedTagIds, pageTitle }) => {
projectId,
})
- usePageTracking({
- context: {
- environmentId,
- organisationId: routeContext.organisationId,
- projectId,
- },
- pageName: Constants.pages.FEATURES,
- saveToStorage: true,
+ useSaveLastEnvironment({
+ environmentId,
+ organisationId: routeContext.organisationId,
+ projectId,
})
const openNewFlagModal = () => {
diff --git a/frontend/web/components/pages/home-page/HomePage.tsx b/frontend/web/components/pages/home-page/HomePage.tsx
index 22e7b3740d0e..361050e88a9d 100644
--- a/frontend/web/components/pages/home-page/HomePage.tsx
+++ b/frontend/web/components/pages/home-page/HomePage.tsx
@@ -12,7 +12,7 @@ import ForgotPasswordModal from 'components/modals/ForgotPasswordModal'
import Card from 'components/Card'
import NavIconSmall from 'components/icons/NavIconSmall'
import ConfigProvider from 'common/providers/ConfigProvider'
-import Constants, { PASSWORD_CHANGED_SESSION_KEY } from 'common/constants'
+import { PASSWORD_CHANGED_SESSION_KEY } from 'common/constants'
import ErrorMessage from 'components/ErrorMessage'
import Button from 'components/base/forms/Button'
import PasswordRequirements from 'components/PasswordRequirements'
@@ -191,8 +191,6 @@ const HomePage: React.FC = () => {
}
}
- API.trackPage(Constants.pages.HOME)
-
if (document.location.href.indexOf('invite') !== -1) {
const invite = params.redirect
if (invite?.includes('invite-link')) {
diff --git a/frontend/web/components/pages/organisation-settings/OrganisationSettingsPage.tsx b/frontend/web/components/pages/organisation-settings/OrganisationSettingsPage.tsx
index 2190e3d528c4..1467207facd8 100644
--- a/frontend/web/components/pages/organisation-settings/OrganisationSettingsPage.tsx
+++ b/frontend/web/components/pages/organisation-settings/OrganisationSettingsPage.tsx
@@ -6,7 +6,6 @@ import Utils from 'common/utils/utils'
import PageTitle from 'components/PageTitle'
import Tabs from 'components/navigation/TabMenu/Tabs'
import TabItem from 'components/navigation/TabMenu/TabItem'
-import Constants from 'common/constants'
import { GeneralTab } from './tabs/general-tab'
import { BillingTab } from './tabs/BillingTab'
import { LicensingTab } from './tabs/LicensingTab'
@@ -36,10 +35,6 @@ const OrganisationSettingsPage: FC = () => {
{ skip: !organisationId },
)
- useEffect(() => {
- API.trackPage(Constants.pages.ORGANISATION_SETTINGS)
- }, [])
-
// Back-compat: renamed tabs redirect so existing bookmarks and links land
// in the right place (SAML became SSO; the API Keys tab became API Access
// with the `keys` slug).
diff --git a/frontend/web/components/pages/project-settings/ProjectSettingsPage.tsx b/frontend/web/components/pages/project-settings/ProjectSettingsPage.tsx
index 4fa1644bde26..43d70960891d 100644
--- a/frontend/web/components/pages/project-settings/ProjectSettingsPage.tsx
+++ b/frontend/web/components/pages/project-settings/ProjectSettingsPage.tsx
@@ -1,11 +1,10 @@
-import React, { ReactNode, useEffect } from 'react'
+import React, { ReactNode } from 'react'
import PageTitle from 'components/PageTitle'
import Tabs from 'components/navigation/TabMenu/Tabs'
import TabItem from 'components/navigation/TabMenu/TabItem'
import BetaFlag from 'components/BetaFlag'
import { useGetProjectQuery } from 'common/services/useProject'
import { useRouteContext } from 'components/providers/RouteContext'
-import Constants from 'common/constants'
import Utils from 'common/utils/utils'
import ProjectUsageTab from './ProjectUsageTab'
import EditHealthProvider from './tabs/EditHealthProvider'
@@ -38,10 +37,6 @@ const ProjectSettingsPage = () => {
{ skip: !projectId },
)
- useEffect(() => {
- API.trackPage(Constants.pages.PROJECT_SETTINGS)
- }, [])
-
const isInitialLoading = isUninitialized || (isLoading && !project)
if (isInitialLoading) {
diff --git a/frontend/web/project/api.ts b/frontend/web/project/api.ts
index 9567c29f467a..d6ad632f6f99 100644
--- a/frontend/web/project/api.ts
+++ b/frontend/web/project/api.ts
@@ -317,10 +317,6 @@ const API = {
}
},
- // Page views were only sent to Universal Analytics. Removed with its callers
- // in a follow-up.
- trackPage(): void {},
-
trackTraits(traits: Record): void {
try {
if (Project.amplitude && traits) {