From cc2d127530ff7b2225b0578738774465844f1844 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 20 May 2022 13:20:49 -0400 Subject: [PATCH 1/5] CSR-216 do not send to logapp if missing sid --- src/mixins/analytics-mixin.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 133187797..05a23a1e2 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -9,12 +9,18 @@ import baseMixin from "@/mixins/base-mixin"; export default { methods: { logPageView(pageEvent) { + // if the user does not have a session id from the content site, do not log. + const sid = getSessionIdValue(); + if (sid === '00000000-0000-0000-0000-000000000000') { + return; + } + const currentPageName = getPageNameByQueryString(); var payload = { userId: getDeviceIdValue(), sessionKey: getSessionKeyValue(), pageName: currentPageName, - sessionId: getSessionIdValue(), + sessionId: sid, action: '', event: pageEvent, shouldUseSessionId: true, @@ -24,6 +30,12 @@ export default { }, logCustomEvent(category, action, label, value) { + // if the user does not have a session id from the content site, do not log. + const sid = getSessionIdValue(); + if (sid === '00000000-0000-0000-0000-000000000000') { + return; + } + const currentPageName = getPageNameByQueryString(); var payload = { userId: getDeviceIdValue(), From 6b53eb74d91b120956fe795048714dc38a5aef05 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 20 May 2022 13:39:41 -0400 Subject: [PATCH 2/5] CSR-216 fix test --- src/mixins/analytics-mixin.spec.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mixins/analytics-mixin.spec.js b/src/mixins/analytics-mixin.spec.js index 8dd49045d..db773da56 100644 --- a/src/mixins/analytics-mixin.spec.js +++ b/src/mixins/analytics-mixin.spec.js @@ -1,5 +1,5 @@ import analyticsMixin from "@/mixins/analytics-mixin"; -import { setupMocksForJsFiles } from "@/helpers/unit-test-helper.js"; +import { setupMocksForJsFiles, setupCookies } from "@/helpers/unit-test-helper.js"; import { storeActions } from "@/constants/store-actions"; describe("analyticsMixin.js", () => { @@ -14,6 +14,12 @@ describe("analyticsMixin.js", () => { } const mocks = setupMocksForJsFiles(mockData); + const testCookieValue = { + sid: '10000000-0000-0000-0000-000000000001' + } + + setupCookies({ funnelCookieValue: JSON.stringify(testCookieValue) }); + analyticsMixin.methods.logPageView(type, payload); expect(mocks.baseMixin.methods.dispatchStoreAction).toBeCalled(); From 9071ddcffd914c434c36ae50bbd7fd46efbc5ac3 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 20 May 2022 14:03:03 -0400 Subject: [PATCH 3/5] CSR-216 use var --- src/mixins/analytics-mixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 05a23a1e2..2e71a0aae 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -41,7 +41,7 @@ export default { userId: getDeviceIdValue(), sessionKey: getSessionKeyValue(), pageName: currentPageName, - sessionId: getSessionIdValue(), + sessionId: sid, category: category, action: action, label: label, From adb74675ff323042daca6b78868429b8019c576e Mon Sep 17 00:00:00 2001 From: CarlNation Date: Fri, 20 May 2022 16:24:52 -0400 Subject: [PATCH 4/5] CSR-216 move the ga event log out of handlecheckchange This was causing every item in the list to log an event not just the selected item. --- src/common-components/button-question/button-question.vue | 3 --- src/mixins/analytics-mixin.js | 4 ++-- .../list-button-horizontal/list-button-horizontal.vue | 2 ++ src/ux-components/list-button/list-button.vue | 2 ++ src/ux-components/list-card/list-card.vue | 2 ++ 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index c2eb72971..07efe470e 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -52,7 +52,6 @@ import listButtonHorizontal from "@/ux-components/list-button-horizontal/list-bu import listCard from "@/ux-components/list-card/list-card"; import { ErrorMessage } from 'vee-validate'; import radio from "@/ux-components/radio/radio"; -import { queryStrings } from "@/constants/query-strings"; export default { name: "buttonQuestion", @@ -135,8 +134,6 @@ export default { }, handleCheckedChanged(val) { - this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, val.value, true); - if(this.isMultiSelect && this.selectedValues) { // Add or remove item to array of data to emit const newSelectedValues = this.selectedValues; diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 2e71a0aae..ca5a24a3e 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -11,7 +11,7 @@ export default { logPageView(pageEvent) { // if the user does not have a session id from the content site, do not log. const sid = getSessionIdValue(); - if (sid === '00000000-0000-0000-0000-000000000000') { + if (sid === '00000000-0000-0000-0000-000000000000' || sid == null) { return; } @@ -32,7 +32,7 @@ export default { logCustomEvent(category, action, label, value) { // if the user does not have a session id from the content site, do not log. const sid = getSessionIdValue(); - if (sid === '00000000-0000-0000-0000-000000000000') { + if (sid === '00000000-0000-0000-0000-000000000000' || sid == null) { return; } diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 974a965b8..eef4be443 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -54,6 +54,7 @@