This commit is contained in:
Kulbhushan Kaushik 2023-01-11 14:00:30 -05:00
parent 19cdc0ed86
commit c9352ccf6d

View file

@ -18,9 +18,18 @@ import { cookieNames } from "@/constants/cookie-names";
import { useMainStore } from "@/store";
export default {
methods: {
methods: {
getPageNameByQueryString() {
const params = new URLSearchParams(location.search);
if (params.has(queryStrings.ISS_PAGE)) {
return params.get(queryStrings.ISS_PAGE);
} else {
return "";
}
},
logPageView(pageEvent) {
const currentPageName = getPageNameByQueryString();
const currentPageName = this.getPageNameByQueryString();
var payload = {
userId: getDeviceIdValue(),
sessionKey: getSessionKeyValue(),
@ -36,7 +45,7 @@ export default {
},
logCustomEvent(category, action, label, value) {
const currentPageName = getPageNameByQueryString();
const currentPageName = this.getPageNameByQueryString();
var payload = {
userId: getDeviceIdValue(),
@ -55,7 +64,7 @@ export default {
},
pushEventToGA(category, action, label, pushToLogApp = false, valueToLogType = null) {
const currentPageName = getPageNameByQueryString();
const currentPageName = this.getPageNameByQueryString();
const labelToLog = getValueToLog(label, valueToLogType);
const eventToBePushed = {
@ -75,7 +84,7 @@ export default {
},
pushPageViewToGA() {
const currentPageName = getPageNameByQueryString();
const currentPageName = this.getPageNameByQueryString();
const pageViewEvent = {
event: GaEvents.PAGE_VIEW_EVENT,
pagePath: `/iss/?${queryStrings.ISS_PAGE}=${currentPageName}`,
@ -187,15 +196,7 @@ function pushToDataLayerIfDefined(data) {
}
}
function getPageNameByQueryString() {
const params = new URLSearchParams(location.search);
if (params.has(queryStrings.ISS_PAGE)) {
return params.get(queryStrings.ISS_PAGE);
} else {
return "";
}
}
function getValueToLog(value, valueToLogType) {
if (valueToLogType != null && valueToLogType === ValueToLogTypes.LAST_5) {