Skip to content

Commit 1ed7cfb

Browse files
Merge pull request #2515 from cfpb/2514-add-custom-analytics-event
πŸš€ Currently on Dev: `v3.2.9b` πŸš€ ## Changes - add `@cfpb/cfpb-analytics` library (same that [consumerfinance.gov uses](https://github.com/cfpb/consumerfinance.gov/blob/main/package.json#L21)) - add a sample test event to OLARFT when a row is saved (same as we did [in SBL](https://github.com/cfpb/sbl-frontend/blob/7169f2123db2a04dbd2fa18a58945883017c2a1f/src/utils/useSignAndCertify.ts#L32-L36)) ## Testing 1. Does the OLARFT page load normally on Dev? Closes #2514
2 parents 15a890d + 76a182a commit 1ed7cfb

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

β€Žpackage.jsonβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"author": "Consumer Financial Protection Bureau",
2626
"license": "CC0-1.0",
2727
"dependencies": {
28+
"@cfpb/cfpb-analytics": "^0.3.2",
2829
"@docsearch/react": "3.6.0",
2930
"@redux-devtools/extension": "^3.3.0",
3031
"@reduxjs/toolkit": "^1.9.7",

β€Žsrc/tools/larft/components/row-editor/Editing.jsxβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { isRowTS } from '../../utils/row'
1111
import { EditingActions } from './EditingActions'
1212
import { EditingParsed } from './EditingParsed'
1313
import { EditingPiped } from './EditingPiped'
14+
import { analyticsSendEvent } from '@cfpb/cfpb-analytics'
1415

1516
/**
1617
* Combined section allowing users to edit a single row's content
@@ -36,6 +37,12 @@ export const Editing = ({ id = 'row-editor' }) => {
3637
const saveHandler = () => {
3738
setChanged(false)
3839
dispatch(rowSave())
40+
const typeOfRow = editingRow["Record Identifier"] === '1' ? 'TS' : 'LAR'
41+
analyticsSendEvent({
42+
event: 'OLARFT Events',
43+
action: 'Successfully saved row',
44+
label: typeOfRow,
45+
});
3946
}
4047

4148
const newHandler = () => {

β€Žyarn.lockβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,6 +1667,13 @@ __metadata:
16671667
languageName: node
16681668
linkType: hard
16691669

1670+
"@cfpb/cfpb-analytics@npm:^0.3.2":
1671+
version: 0.3.2
1672+
resolution: "@cfpb/cfpb-analytics@npm:0.3.2"
1673+
checksum: 10c0/7f1da9c1c6612432701b6919e0ce4aff18d856721b15b3739531013bdba52d0b88facb6f3567ab79a7ed4522e3d8a33b896be4b8f4276431d38bd8573c8bdaa7
1674+
languageName: node
1675+
linkType: hard
1676+
16701677
"@colors/colors@npm:1.5.0":
16711678
version: 1.5.0
16721679
resolution: "@colors/colors@npm:1.5.0"
@@ -6739,6 +6746,7 @@ __metadata:
67396746
dependencies:
67406747
"@babel/preset-env": "npm:^7.23.8"
67416748
"@babel/preset-react": "npm:^7.23.3"
6749+
"@cfpb/cfpb-analytics": "npm:^0.3.2"
67426750
"@cypress/skip-test": "npm:2.6.0"
67436751
"@docsearch/react": "npm:3.6.0"
67446752
"@esbuild-plugins/node-globals-polyfill": "npm:^0.2.3"

0 commit comments

Comments
Β (0)