CSR-1339
Add GA event to show what button options displayed
This commit is contained in:
parent
43954352a0
commit
f18e00caed
4 changed files with 73 additions and 37 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ const GaActions = {
|
||||||
CLICKED: "Clicked",
|
CLICKED: "Clicked",
|
||||||
VIF: "vif",
|
VIF: "vif",
|
||||||
SUBMITTED: "Submitted",
|
SUBMITTED: "Submitted",
|
||||||
|
DISPLAYED: "Displayed",
|
||||||
};
|
};
|
||||||
|
|
||||||
const GaLabels = {
|
const GaLabels = {
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -715,18 +715,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,
|
||||||
}).then((response) => {
|
logApiCall: false,
|
||||||
return response;
|
})
|
||||||
},
|
.then(
|
||||||
(error) => {
|
(response) => {
|
||||||
console.log("Analytics Service Error: " + error.data);
|
return response;
|
||||||
}
|
},
|
||||||
);
|
(error) => {
|
||||||
|
console.log("Analytics Service Error: " + error.data);
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
logCustomEvent(
|
logCustomEvent(
|
||||||
context,
|
context,
|
||||||
|
|
@ -757,18 +760,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,
|
||||||
}).then((response) => {
|
logApiCall: false,
|
||||||
return response;
|
})
|
||||||
},
|
.then(
|
||||||
(error) => {
|
(response) => {
|
||||||
console.log("Analytics Service Error: " + error.data);
|
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 = {
|
||||||
|
|
@ -782,18 +788,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,
|
||||||
}).then((response) => {
|
logApiCall: false,
|
||||||
return response;
|
})
|
||||||
},
|
.then(
|
||||||
(error) => {
|
(response) => {
|
||||||
console.log("Analytics Service Error: " + error.data);
|
return response;
|
||||||
}
|
},
|
||||||
);
|
(error) => {
|
||||||
|
console.log("Analytics Service Error: " + error.data);
|
||||||
|
}
|
||||||
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Misc Actions
|
// Misc Actions
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue