Merge pull request #1195 from Safelite/feature/CSR-1439.1

CSR-1439 remove params from endpoint logging
This commit is contained in:
Matt Caimi 2023-06-29 15:33:48 -04:00 committed by GitHub
commit 45c407046b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -39,9 +39,11 @@ export default {
}
const pageName = analyticsMixIn.methods.getPageName();
const nextPageName = router.lastNavigationPage || pageName;
const endpointWithoutParams =
analyticsMixIn.methods.removeParamsFromEndpoint(endpoint);
analyticsMixIn.methods.pushEventToGA(
GaCategories.API_RESPONSE,
`${nextPageName}_${endpoint}`,
`${nextPageName}_${endpointWithoutParams}`,
`${GaLabels.SUCCESS}${additionalEventData}`,
true
);

View file

@ -176,6 +176,17 @@ export default {
getSessionIdValue() === "00000000-0000-0000-0000-000000000000"
);
},
removeParamsFromEndpoint(endpoint) {
const numSlashesBeforeParams = 6;
let splitString = endpoint.split("/");
if (splitString.length > numSlashesBeforeParams) {
splitString = splitString.slice(0, numSlashesBeforeParams);
return splitString.join("/");
} else {
return endpoint;
}
},
},
computed: {
analyticsPageEvents() {