Merge pull request #1075 from Safelite/feature/CSR-1339

CSR-1339
This commit is contained in:
CarlNation 2023-04-25 10:05:20 -04:00 committed by GitHub
commit 97c38af4d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 78 additions and 24 deletions

View file

@ -79,6 +79,7 @@ import listButtonHorizontal from "@/ux-components/list-button-horizontal/list-bu
import listCard from "@/ux-components/list-card/list-card"; import listCard from "@/ux-components/list-card/list-card";
import radio from "@/ux-components/radio/radio"; import radio from "@/ux-components/radio/radio";
import { ErrorMessage } from "vee-validate"; import { ErrorMessage } from "vee-validate";
import { queryStrings } from "@/constants/query-strings";
export default { export default {
name: "buttonQuestion", name: "buttonQuestion",
@ -119,6 +120,10 @@ export default {
useTextForValue: Boolean, useTextForValue: Boolean,
valueToLogType: String, valueToLogType: String,
additionalButtonStyling: String, additionalButtonStyling: String,
logDisplayedValuesEvent: {
type: Boolean,
default: false,
},
}, },
beforeMount() { beforeMount() {
if (this.buttonTypeObject) { if (this.buttonTypeObject) {
@ -130,6 +135,26 @@ export default {
lastValuePushedToGa: null, lastValuePushedToGa: null,
}; };
}, },
watch: {
answers() {
//once we get the answers to display from parent, see if we need a GA event to log what we showed
if (this.logDisplayedValuesEvent && this.answers.length > 0) {
var eventLabel = "";
//build comma separated list of all items in button list that we are going to display on page
this.answers.forEach((item) => {
eventLabel += item.Name + ",";
});
eventLabel = eventLabel.slice(0, -1); //remove the last comma
this.pushEventToGA(
this.$route.query[queryStrings.FMG_PAGE],
this.GaActions.DISPLAYED,
eventLabel,
true
);
}
},
},
computed: { computed: {
getFieldSetClasses() { getFieldSetClasses() {
if (this.isOverflowScrollable) { if (this.isOverflowScrollable) {

View file

@ -19,6 +19,7 @@ const GaActions = {
CLICKED: "Clicked", CLICKED: "Clicked",
VIF: "vif", VIF: "vif",
SUBMITTED: "Submitted", SUBMITTED: "Submitted",
DISPLAYED: "Displayed",
}; };
const GaLabels = { const GaLabels = {

View file

@ -18,7 +18,8 @@
buttonTypeString="listButton" buttonTypeString="listButton"
v-model="selectedVinLookupMethod" v-model="selectedVinLookupMethod"
isRequired isRequired
validationRules="option-required" /> validationRules="option-required"
:logDisplayedValuesEvent="true" />
</div> </div>
<div v-else> <div v-else>
<alert <alert

View file

@ -146,18 +146,18 @@ export default {
false false
); );
if (response.data) { if (response?.data) {
if (response.data.sessionKey && skey === 0) { if (response?.data.sessionKey && skey === 0) {
setCookieProperties( setCookieProperties(
{ [cookieNames.SESSION_KEY]: response.data.sessionKey }, { [cookieNames.SESSION_KEY]: response?.data.sessionKey },
{ {
useDefaultFunnelCookieAttributes: false, useDefaultFunnelCookieAttributes: false,
} }
); );
} }
if (response.data.sessionId && sid === "00000000-0000-0000-0000-000000000000") { if (response?.data.sessionId && sid === "00000000-0000-0000-0000-000000000000") {
setCookieProperties( setCookieProperties(
{ [cookieNames.SESSION_ID]: response.data.sessionId }, { [cookieNames.SESSION_ID]: response?.data.sessionId },
{ {
maxAge: 60 * 30, // 30 minutes maxAge: 60 * 30, // 30 minutes
} }

View file

@ -725,12 +725,21 @@ export const actions = {
experimentsForUser: experimentsForUser, experimentsForUser: experimentsForUser,
}; };
return globalMethods.callHttpClient({ return globalMethods
method: endpoints.LogPageView.method, .callHttpClient({
endpoint: endpoints.LogPageView.url, method: endpoints.LogPageView.method,
payload: payload, endpoint: endpoints.LogPageView.url,
logApiCall: false, payload: payload,
}); logApiCall: false,
})
.then(
(response) => {
return response;
},
(error) => {
console.log("Analytics Service Error: " + error.data);
}
);
}, },
logCustomEvent( logCustomEvent(
context, context,
@ -761,12 +770,21 @@ export const actions = {
experimentsForUser: experimentsForUser, experimentsForUser: experimentsForUser,
}; };
return globalMethods.callHttpClient({ return globalMethods
method: endpoints.LogCustomEvent.method, .callHttpClient({
endpoint: endpoints.LogCustomEvent.url, method: endpoints.LogCustomEvent.method,
payload: payload, endpoint: endpoints.LogCustomEvent.url,
logApiCall: false, payload: payload,
}); logApiCall: false,
})
.then(
(response) => {
return response;
},
(error) => {
console.log("Analytics Service Error: " + error.data);
}
);
}, },
initializeSession(context, { userId, sessionId, userAgent, referrer }) { initializeSession(context, { userId, sessionId, userAgent, referrer }) {
var payload = { var payload = {
@ -780,12 +798,21 @@ export const actions = {
referrer: referrer, referrer: referrer,
}; };
return globalMethods.callHttpClient({ return globalMethods
method: endpoints.InitializeSession.method, .callHttpClient({
endpoint: endpoints.InitializeSession.url, method: endpoints.InitializeSession.method,
payload: payload, endpoint: endpoints.InitializeSession.url,
logApiCall: false, payload: payload,
}); logApiCall: false,
})
.then(
(response) => {
return response;
},
(error) => {
console.log("Analytics Service Error: " + error.data);
}
);
}, },
// Misc Actions // Misc Actions