Updates
This commit is contained in:
parent
ba4191e891
commit
ca218e9d40
2 changed files with 13 additions and 27 deletions
|
|
@ -16,15 +16,13 @@ import {
|
||||||
ValueToLogTypes,
|
ValueToLogTypes,
|
||||||
} from "@/constants/analytics";
|
} from "@/constants/analytics";
|
||||||
import { cookieNames } from "@/constants/cookie-names";
|
import { cookieNames } from "@/constants/cookie-names";
|
||||||
//import { useMainStore } from "@/store";
|
import { useMainStore } from "@/store";
|
||||||
|
|
||||||
import baseMixin from "@/mixins/base-mixin";
|
import baseMixin from "@/mixins/base-mixin";
|
||||||
//import { mapStores } from "pinia";
|
import { mapStores } from "pinia";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
methods: {
|
||||||
methods: {
|
|
||||||
|
|
||||||
logPageView(pageEvent) {
|
logPageView(pageEvent) {
|
||||||
const currentPageName = getPageNameByQueryString();
|
const currentPageName = getPageNameByQueryString();
|
||||||
var payload = {
|
var payload = {
|
||||||
|
|
@ -35,7 +33,7 @@ export default {
|
||||||
action: "",
|
action: "",
|
||||||
event: pageEvent,
|
event: pageEvent,
|
||||||
shouldUseSessionId: false,
|
shouldUseSessionId: false,
|
||||||
experimentsForUser: [], //useMainStore.applicationUser.experiments,
|
experimentsForUser: useMainStore().applicationUser.experiments,
|
||||||
};
|
};
|
||||||
|
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.LOG_PAGE_VIEW, payload, false);
|
baseMixin.methods.dispatchStoreAction(storeActions.LOG_PAGE_VIEW, payload, false);
|
||||||
|
|
@ -54,7 +52,7 @@ export default {
|
||||||
label: label,
|
label: label,
|
||||||
value: value,
|
value: value,
|
||||||
shouldUseSessionId: false,
|
shouldUseSessionId: false,
|
||||||
experimentsForUser: [], //useMainStore.applicationUser.experiments,
|
experimentsForUser: useMainStore().applicationUser.experiments,
|
||||||
};
|
};
|
||||||
|
|
||||||
baseMixin.methods.dispatchStoreAction(storeActions.LOG_CUSTOM_EVENT, payload, false);
|
baseMixin.methods.dispatchStoreAction(storeActions.LOG_CUSTOM_EVENT, payload, false);
|
||||||
|
|
@ -94,7 +92,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
pushExperimentsToDataLayer() {
|
pushExperimentsToDataLayer() {
|
||||||
const experiments = []; //useMainStore.applicationUser.experiments;
|
const experiments = useMainStore().applicationUser.experiments;
|
||||||
experiments?.forEach((exp) => {
|
experiments?.forEach((exp) => {
|
||||||
// Set Google Dimension Index based on experiment settings.
|
// Set Google Dimension Index based on experiment settings.
|
||||||
let googleDimensionIndex = 99;
|
let googleDimensionIndex = 99;
|
||||||
|
|
@ -173,7 +171,8 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
//...mapStores(useMainStore),
|
...mapStores(useMainStore),
|
||||||
|
|
||||||
analyticsPageEvents() {
|
analyticsPageEvents() {
|
||||||
return analyticsPageEvents;
|
return analyticsPageEvents;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -243,7 +243,7 @@ export const useMainStore = defineStore({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
logPageView({ userId, sessionKey, pageName, sessionId, action })
|
logPageView({ userId, sessionKey, pageName, sessionId, action, event, shouldUseSessionId, experimentsForUser })
|
||||||
{
|
{
|
||||||
var payload = {
|
var payload = {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
|
|
@ -263,21 +263,8 @@ export const useMainStore = defineStore({
|
||||||
logApiCall: false,
|
logApiCall: false,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
logCustomEvent(
|
logCustomEvent({ userId, sessionKey, pageName, sessionId, category, action, label, value, shouldUseSessionId, experimentsForUser})
|
||||||
context,
|
{
|
||||||
{
|
|
||||||
userId,
|
|
||||||
sessionKey,
|
|
||||||
pageName,
|
|
||||||
sessionId,
|
|
||||||
category,
|
|
||||||
action,
|
|
||||||
label,
|
|
||||||
value,
|
|
||||||
shouldUseSessionId,
|
|
||||||
experimentsForUser,
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
var payload = {
|
var payload = {
|
||||||
userId: userId,
|
userId: userId,
|
||||||
sessionKey: sessionKey,
|
sessionKey: sessionKey,
|
||||||
|
|
@ -299,7 +286,7 @@ export const useMainStore = defineStore({
|
||||||
logApiCall: false,
|
logApiCall: false,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
initializeSession(context, { userId, sessionId, userAgent, referrer }) {
|
initializeSession({ userId, sessionId, userAgent, referrer }) {
|
||||||
var payload = {
|
var payload = {
|
||||||
applicationName: applicationConfig.APPLICATION_NAME,
|
applicationName: applicationConfig.APPLICATION_NAME,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
|
|
@ -319,7 +306,7 @@ export const useMainStore = defineStore({
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateLastPageVisited(state, lastPageVisited) {
|
updateLastPageVisited(lastPageVisited) {
|
||||||
this.applicationUser.lastPageVisited = lastPageVisited;
|
this.applicationUser.lastPageVisited = lastPageVisited;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue