Skip to content

Commit

Permalink
feat(Google Analytics): add appropriate Google Analytics tags to the …
Browse files Browse the repository at this point in the history
…various endpoints (#301)

Co-authored-by: Mike Dial <[email protected]
  • Loading branch information
kristin-at-theta authored Jan 16, 2024
1 parent 63e004a commit 685f680
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/services/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
"tailwindcss": "^3.3.1",
"typescript": "^5.2.0",
"vite": "^4.2.0",
"vite-plugin-radar": "^0.9.2",
"vitest": "^0.30.1"
}
}
3 changes: 3 additions & 0 deletions src/services/ui/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ custom:
stage: ${opt:stage, self:provider.stage}
region: ${opt:region, self:provider.region}
idmInfo: ${ssm:/aws/reference/secretsmanager/${self:custom.project}/${sls:stage}/idmInfo, ""}
googleAnalytics: ${ssm:/aws/reference/secretsmanager/${self:custom.project}/${sls:stage}/googleAnalytics, ssm:/aws/reference/secretsmanager/${self:custom.project}/default/googleAnalytics}
serverlessTerminationProtection:
stages:
- master
Expand All @@ -46,6 +47,8 @@ custom:
VITE_COGNITO_REDIRECT_SIGNIN=${param:ApplicationEndpointUrl}
VITE_COGNITO_REDIRECT_SIGNOUT=${param:ApplicationEndpointUrl}
VITE_IDM_HOME_URL=${self:custom.idmInfo.home_url, "https://test.home.idm.cms.gov"}
VITE_GOOGLE_ANALYTICS_GTAG=${self:custom.googleAnalytics.gtag}
VITE_GOOGLE_ANALYTICS_DISABLE=${self:custom.googleAnalytics.disable, "false"}
""" > .env.local
yarn build
deploy:finalize: |
Expand Down
14 changes: 13 additions & 1 deletion src/services/ui/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import { defineConfig } from "vitest/config";
import react from "@vitejs/plugin-react-swc";
import { fileURLToPath } from "url";
import { VitePluginRadar } from "vite-plugin-radar";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [
react(),
VitePluginRadar({
enableDev: true,
analytics: [
{
id: process.env.VITE_GOOGLE_ANALYTICS_GTAG,
disable: process.env.VITE_GOOGLE_ANALYTICS_DISABLE === "true",
},
],
}),
],
server: {
port: 5000,
},
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15024,6 +15024,11 @@ [email protected]:
picocolors "^1.0.0"
vite "^3.0.0 || ^4.0.0 || ^5.0.0-0"

vite-plugin-radar@^0.9.2:
version "0.9.2"
resolved "https://registry.yarnpkg.com/vite-plugin-radar/-/vite-plugin-radar-0.9.2.tgz#e1e0acaf08be956d22b001b05edd2962a6b4286e"
integrity sha512-cIwA7EU/6kqIPjSAFIjpnleJBtDVxw0lBwMyWIp8kit/O3XehHly+B6jCN7FbfQjniRxEtBarEzrLB+FmKSnAg==

"vite@^3.0.0 || ^4.0.0", "vite@^3.0.0 || ^4.0.0 || ^5.0.0-0", "vite@^3.1.0 || ^4.0.0 || ^5.0.0-0", vite@^4.2.0:
version "4.4.11"
resolved "https://registry.yarnpkg.com/vite/-/vite-4.4.11.tgz#babdb055b08c69cfc4c468072a2e6c9ca62102b0"
Expand Down

0 comments on commit 685f680

Please sign in to comment.