Skip to content

Commit

Permalink
- First pass analytics fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mistergone committed Jul 10, 2024
1 parent b83d6b6 commit 01da9d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ import { analyticsSendEvent } from '@cfpb/cfpb-analytics';

/**

Check warning on line 3 in cfgov/unprocessed/apps/paying-for-college/js/college-costs/util/analytics.js

View workflow job for this annotation

GitHub Actions / frontend

Missing JSDoc @returns declaration
* Sends an event to the dataLayer for Google Tag Manager
* @param {string} action - The type of event or action taken
* @param {string|object} action - The type of event or action taken, OR a payload Object
* @param {string} label - A value or label for the action
*/
function sendAnalyticsEvent(action, label) {
analyticsSendEvent({
action,
label,
event: 'P4C Financial Path Interaction',
});
if ( typeof action === 'object' ) {
analyticsSendEvent(payload);

Check failure on line 10 in cfgov/unprocessed/apps/paying-for-college/js/college-costs/util/analytics.js

View workflow job for this annotation

GitHub Actions / frontend

'payload' is not defined
return payload;

Check failure on line 11 in cfgov/unprocessed/apps/paying-for-college/js/college-costs/util/analytics.js

View workflow job for this annotation

GitHub Actions / frontend

'payload' is not defined
} else {
analyticsSendEvent({
action,
label,
event: 'P4C Financial Path Interaction',
});
}

}

export { sendAnalyticsEvent };
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const appView = {
);
appView._restartBtn = document.querySelector('[data-app-button="restart"]');
appView._saveForLaterBtn = document.querySelector(
'[data-app-button="save-and-finish-later"]',
'.a-btn--link[data-destination="save-finish"]',
);
appView._saveLinks = document.querySelectorAll('[data-app-save-link]');
appView._copyLinkBtn = document.querySelectorAll('.copy-your-link');
Expand Down

0 comments on commit 01da9d3

Please sign in to comment.