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