Skip to content

Commit

Permalink
[HCAP-1527] Snowplow - added tracking parameter - selected pathway on…
Browse files Browse the repository at this point in the history
… successful participant EOI
  • Loading branch information
kushal-arora-fw committed Jul 9, 2024
1 parent 439506d commit 4077921
Showing 5 changed files with 29 additions and 4 deletions.
6 changes: 5 additions & 1 deletion client/src/components/participant-form/index.js
Original file line number Diff line number Diff line change
@@ -10,9 +10,10 @@ import {
ParticipantEditFormSchema,
Routes,
ToastStatus,
ProgramLabel,
} from '../../constants';
import { useToast } from '../../hooks';
import { scrollUp } from '../../utils';
import { snowplowCallEventSelectPathway, scrollUp } from '../../utils';

import { Button } from '../generic';
import { Summary } from './Summary';
@@ -69,6 +70,9 @@ export const Form = ({
});

if (response.ok) {
// call snowplow integration with selected pathway value
snowplowCallEventSelectPathway(ProgramLabel[values.program]);

const { id } = await response.json();
history.push(Routes.ParticipantConfirmation, { formValues: values, id });
} else {
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import { SectionHeader } from '../SectionHeader';
import { FastField } from 'formik';
import { RenderRadioGroup } from '../../fields';
import { PleaseNoteBanner } from '../PleaseNoteBanner';
import { Program } from '../../../constants';
import { Program, ProgramLabel } from '../../../constants';

export const HCAPProgramSection = ({ checkFieldDisability }) => {
return (
@@ -21,8 +21,8 @@ export const HCAPProgramSection = ({ checkFieldDisability }) => {
setTouched
row
options={[
{ value: Program.HCA, label: 'Health Care Assistant - HCAP' },
{ value: Program.MHAW, label: 'Mental Health and Addictions Worker - HCAP' },
{ value: Program.HCA, label: ProgramLabel.HCA },
{ value: Program.MHAW, label: ProgramLabel.MHAW },
]}
/>
</Grid>
5 changes: 5 additions & 0 deletions client/src/constants/programs.js
Original file line number Diff line number Diff line change
@@ -4,3 +4,8 @@ export const Program = {
NonHCAP: 'Non-HCAP',
Unknown: 'Unknown',
};

export const ProgramLabel = {
HCA: 'Health Care Assistant - HCAP',
MHAW: 'Mental Health and Addictions Worker - HCAP'
}
1 change: 1 addition & 0 deletions client/src/utils/index.js
Original file line number Diff line number Diff line change
@@ -10,3 +10,4 @@ export * from './csvReports';
export * from './keycloak-util';
export * from './formatOptions';
export * from './form-conditionals';
export * from './snowplowCallEvent';
15 changes: 15 additions & 0 deletions client/src/utils/snowplowCallEvent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* @method callEventSelectPathway
* @description This is a snowplow event selector to track when user submits the survey.
* @param text defines the selected pathway after successful submission
*/
export const snowplowCallEventSelectPathway = (text) => {
// call snowplow to track the event
window.snowplow('trackSelfDescribingEvent', {
schema: 'iglu:ca.bc.gov.hcap/action/jsonschema/1-0-0',
data: {
action: 'select_pathway',
text,
},
});
};

0 comments on commit 4077921

Please sign in to comment.