CSR-18 page name function only called once so never it changed

This commit is contained in:
CarlNation 2022-05-11 15:16:03 -04:00
parent 83c649fc8d
commit 93c12a127e

View file

@ -6,12 +6,10 @@ import { analyticsPageEvents, GaCategories, GaActions, GaLabels, GaEvents } from
import baseMixin from "@/mixins/base-mixin"; import baseMixin from "@/mixins/base-mixin";
// We will need current page name for multiple methods, define it once to re-use.
const currentPageName = getPageNameByQueryString();
export default { export default {
methods: { methods: {
logPageView(pageEvent) { logPageView(pageEvent) {
const currentPageName = getPageNameByQueryString();
var payload = { var payload = {
userId: getDeviceIdValue(), userId: getDeviceIdValue(),
sessionKey: getSessionKeyValue(), sessionKey: getSessionKeyValue(),
@ -26,6 +24,7 @@ export default {
}, },
logCustomEvent(category, action, label, value) { logCustomEvent(category, action, label, value) {
const currentPageName = getPageNameByQueryString();
var payload = { var payload = {
userId: getDeviceIdValue(), userId: getDeviceIdValue(),
sessionKey: getSessionKeyValue(), sessionKey: getSessionKeyValue(),
@ -42,6 +41,7 @@ export default {
}, },
pushEventToGA(category, action, label, pushToLogApp = false) { pushEventToGA(category, action, label, pushToLogApp = false) {
const currentPageName = getPageNameByQueryString();
const eventToBePushed = { const eventToBePushed = {
'event': GaEvents.GENERIC_EVENT, 'event': GaEvents.GENERIC_EVENT,
'category': category, 'category': category,
@ -60,6 +60,7 @@ export default {
}, },
pushPageViewToGA() { pushPageViewToGA() {
const currentPageName = getPageNameByQueryString();
const pageViewEvent = { const pageViewEvent = {
'event': GaEvents.PAGE_VIEW_EVENT, 'event': GaEvents.PAGE_VIEW_EVENT,
'pagePath': `/fmg/?${queryStrings.FMG_PAGE}=${currentPageName}`, 'pagePath': `/fmg/?${queryStrings.FMG_PAGE}=${currentPageName}`,