diff --git a/.env.development b/.env.development index c16bc479e..3471bb65e 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,5 @@ REACT_APP_GTM_ID=GTM-WVXPS94 +REACT_APP_GA4_ID=G-3G0Z44ZM07 REACT_APP_API_URL=https://dev.unguess.io/api REACT_APP_TRYBER_URL=https://dev.tryber.me REACT_ZAPIER_WEBHOOK=https://hooks.zapier.com/hooks/catch/5196925/bkxm1k6/ diff --git a/.env.production b/.env.production index 214e6c338..77c2ae402 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,5 @@ REACT_APP_GTM_ID=GTM-WVXPS94 +REACT_APP_GA4_ID=G-2M29YVTK78 REACT_APP_API_URL=/api REACT_APP_TRYBER_URL=https://app.tryber.me REACT_ZAPIER_WEBHOOK=https://hooks.zapier.com/hooks/catch/5196925/bkxm1k6/ diff --git a/package.json b/package.json index 373027064..5a154e412 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.4.0", "private": true, "dependencies": { + "@analytics/google-analytics": "^1.1.0", "@analytics/google-tag-manager": "^0.6.0", "@analytics/hubspot": "^0.5.1", "@appquality/languages": "1.4.3", diff --git a/src/analytics.ts b/src/analytics.ts index 7af21f064..ef760bb07 100644 --- a/src/analytics.ts +++ b/src/analytics.ts @@ -1,6 +1,7 @@ +import googleAnalytics from '@analytics/google-analytics'; import googleTagManager from '@analytics/google-tag-manager'; -import Analytics from 'analytics'; import hubspotPlugin from '@analytics/hubspot'; +import Analytics from 'analytics'; import userpilot from './common/analytics-plugins/userpilot'; import { isDev } from './common/isDevEnvironment'; @@ -15,6 +16,10 @@ const analytics = Analytics({ preview: 'env-4', }), }), + // fallback to staging/local GA4 if no production ID is provided + googleAnalytics({ + measurementIds: [process.env.REACT_APP_GA4_ID || 'G-3G0Z44ZM07'], + }), userpilot({ token: 'NX-54e88e10', }), diff --git a/src/common/components/PlanCreationInterface/ProjectDropdown.tsx b/src/common/components/PlanCreationInterface/ProjectDropdown.tsx index 1d4a2d7bb..e15c2b421 100644 --- a/src/common/components/PlanCreationInterface/ProjectDropdown.tsx +++ b/src/common/components/PlanCreationInterface/ProjectDropdown.tsx @@ -63,12 +63,18 @@ export const ProjectDropdown = () => { setProjectId(value.id); } }} - options={(projects || []).map((prj) => ({ - id: prj.id.toString(), - value: prj.id.toString(), - label: prj.name, - isSelected: projectId === prj.id, - }))} + options={[ + { + id: 'options-group', + label: t('__PLAN_CREATION_PROJECT_DROPDOWN_PLACEHOLDER'), + options: (projects || []).map((prj) => ({ + id: prj.id.toString(), + value: prj.id.toString(), + label: prj.name, + isSelected: projectId === prj.id, + })), + }, + ]} placeholder={t('__PLAN_CREATION_PROJECT_DROPDOWN_PLACEHOLDER')} selectionValue={projectId?.toString() || ''} {...(hasValidationError && { validation: 'error' })} diff --git a/src/google-analytics.d.ts b/src/google-analytics.d.ts new file mode 100644 index 000000000..159a5e3e6 --- /dev/null +++ b/src/google-analytics.d.ts @@ -0,0 +1 @@ +declare module '@analytics/google-analytics'; diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 7905ff02e..964a93dcb 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -768,7 +768,7 @@ "__PLAN_ADDITIONAL_TARGET_ERROR_TOO_LONG": "This text is a bit long. It is recommended not to exceed 512 characters, including spaces.", "__PLAN_ASIDE_NAVIGATION_MODULES_TITLE": "IN THIS SECTION", "__PLAN_CREATION_PROJECT_DROPDOWN_ERROR": "Select a project", - "__PLAN_CREATION_PROJECT_DROPDOWN_PLACEHOLDER": "Select a project", + "__PLAN_CREATION_PROJECT_DROPDOWN_PLACEHOLDER": "Select or create a new project", "__PLAN_DATE_ERROR_REQUIRED": "Required field: enter a date to continue", "__PLAN_DATE_IN_FUTURE_ERROR": "Date must be at least one business day in the future", "__PLAN_DELETE_PLAN_CTA": "Delete draft", diff --git a/src/pages/Profile/parts/FollowActivitiesAccordion.tsx/index.tsx b/src/pages/Profile/parts/FollowActivitiesAccordion.tsx/index.tsx index f0cfcec11..75bdea493 100644 --- a/src/pages/Profile/parts/FollowActivitiesAccordion.tsx/index.tsx +++ b/src/pages/Profile/parts/FollowActivitiesAccordion.tsx/index.tsx @@ -19,11 +19,7 @@ export const FollowActivitiesAccordion = () => { isError, } = useGetUsersMeWatchedPlansQuery(); - const { - data: followedCampaigns, - isLoading: isCampaignsLoading, - isError: isCampaignsError, - } = useGetUsersMeWatchedCampaignsQuery(); + const { data: followedCampaigns } = useGetUsersMeWatchedCampaignsQuery(); const totalFollowed = (followedActivities?.items.length || 0) + (followedCampaigns?.items.length || 0); diff --git a/yarn.lock b/yarn.lock index 4fd0ade66..3474713e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -38,6 +38,11 @@ dependencies: "@analytics/type-utils" "^0.6.2" +"@analytics/google-analytics@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@analytics/google-analytics/-/google-analytics-1.1.0.tgz#901e20b8c0ad10e26118317a5b6d5e98f927037f" + integrity sha512-i8uGyELMtwEUAf3GNWNLNBzhRvReDn1RUxvMdMhjUA7+GNGxPOM4kkzFfv3giQXKNxTEjfsh75kqNcscbJsuaA== + "@analytics/google-tag-manager@^0.6.0": version "0.6.0" resolved "https://registry.yarnpkg.com/@analytics/google-tag-manager/-/google-tag-manager-0.6.0.tgz#bc1d20bb77450171848af2acaacfe1554e6aa19c"