Skip to content

Commit

Permalink
fix: tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed May 28, 2024
1 parent 33ac6b6 commit a1774bc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 15 deletions.
20 changes: 13 additions & 7 deletions src/components/Checkout/CheckoutDropInPaymentWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@
<p v-else-if="$v.email.$error" class="input-error tw-text-danger tw-text-base tw-mb-2">
Valid email required.
</p>
<template v-if="enableCommsExperiment">
<template v-if="enableRadioBtnExperiment">
<fieldset class="tw-flex tw-flex-col tw-gap-2 tw-mt-1 tw-mb-2 tw-text-small">
<kv-radio
value="1"
name="reportComms"
v-model="selectedComms"
v-kv-track-event="[
'basket',
'click-marketing-updates',
'click',
'marketing-updates',
// eslint-disable-next-line max-len
'Receive email updates from Kiva (including borrower updates and promos). You can unsubscribe anytime.',
]"
Expand All @@ -78,7 +79,8 @@
:class="{'radio-error': $v.selectedComms.$error}"
v-kv-track-event="[
'basket',
'click-marketing-updates',
'click',
'marketing-updates',
// eslint-disable-next-line max-len
'Dont receive email updates from Kiva (including borrower updates and promos). You can unsubscribe anytime.',
]"
Expand Down Expand Up @@ -110,7 +112,8 @@
v-model="termsAgreement"
@update:modelValue="$kvTrackEvent(
'basket',
'click-terms-of-use',
'click',
'terms-of-use',
'I have read and agree to the Terms of Use and Privacy Policy',
$event ? 1 : 0
)"
Expand Down Expand Up @@ -140,7 +143,8 @@
v-model="emailUpdates"
@update:modelValue="$kvTrackEvent(
'basket',
'click-marketing-updates',
'click',
'marketing-updates',
emailUpdatesCopy,
$event ? 1 : 0
)"
Expand Down Expand Up @@ -231,6 +235,7 @@ export default {
paymentTypes: ['paypal', 'card', 'applePay', 'googlePay'],
enableCommsExperiment: true,
selectedComms: '',
enableRadioBtnExperiment: true,
};
},
validations: {
Expand Down Expand Up @@ -459,8 +464,6 @@ export default {
// redirect to thanks with KIVA transaction id
if (transactionId) {
// fire BT Success event
this.$kvTrackEvent?.('basket', 'click', 'opt-in-communication', Boolean(this.selectedComms));
this.$kvTrackEvent(
'basket',
`${paymentType} Braintree DropIn Payment`,
Expand Down Expand Up @@ -507,6 +510,9 @@ export default {
if (version === 'b') {
this.enableCommsExperiment = true;
}
if (version === 'c') {
this.enableRadioBtnExperiment = true;
}
}
}
};
Expand Down
35 changes: 27 additions & 8 deletions src/pages/LoginAndRegister/RegisterSocial.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,20 @@
Enter last name.
</template>
</kv-base-input>
<template v-if="enableCommsExperiment">
<template v-if="enableRadioBtnExperiment">
<fieldset class="tw-flex tw-flex-col tw-gap-2 tw-mt-1 tw-mb-2 tw-text-small">
<kv-radio
value="1"
name="reportComms"
v-model="selectedTerms"
:class="{'radio-error': $v.selectedTerms.$error}"
v-kv-track-event="[
'authentication',
'click',
'marketing-updates',
// eslint-disable-next-line max-len
'Receive email updates from Kiva (including borrower updates and promos). You can unsubscribe anytime.',
]"
>
<!-- eslint-disable-next-line max-len -->
Receive email updates from Kiva (including borrower updates and promos). You can unsubscribe anytime.
Expand All @@ -82,8 +89,9 @@
v-model="selectedComms"
:class="{'radio-error': $v.selectedComms.$error}"
v-kv-track-event="[
'basket',
'click-marketing-updates',
'authentication',
'click',
'marketing-updates',
// eslint-disable-next-line max-len
'Dont receive email updates from Kiva (including borrower updates and promos). You can unsubscribe anytime.',
]"
Expand Down Expand Up @@ -114,6 +122,13 @@
v-show="needsTerms"
v-model="newAcctTerms"
:validation="$v.newAcctTerms"
@update:modelValue="$kvTrackEvent(
'authentication',
'click',
'terms-of-use',
'I have read and agree to the Terms of Use and Privacy Policy',
$event ? 1 : 0
)"
>
I have read and agree to the Kiva
<a href="/legal/terms" target="_blank">Terms of Use</a>
Expand All @@ -133,13 +148,14 @@
v-show="needsNews"
v-model="newsConsent"
@update:modelValue="$kvTrackEvent(
'Login',
'click-marketing-updates',
'authentication',
'click',
'marketing-updates',
emailUpdatesCopy,
$event ? 1 : 0
)"
>
{{ updateEmailsCopy }}
{{ emailUpdatesCopy }}
</kv-base-input>
</template>
<div class="tw-mb-4">
Expand Down Expand Up @@ -233,6 +249,7 @@ export default {
fetchedLogoUrl: null,
enableCommsExperiment: false,
selectedComms: '',
enableRadioBtnExperiment: false,
};
},
computed: {
Expand Down Expand Up @@ -283,7 +300,7 @@ export default {
checked: val => val,
};
}
if (this.enableCommsExperiment) {
if (this.enableRadioBtnExperiment) {
validations.selectedComms = {
required,
checked: val => val !== '',
Expand Down Expand Up @@ -351,6 +368,9 @@ export default {
if (version === 'b') {
this.enableCommsExperiment = true;
}
if (version === 'c') {
this.enableRadioBtnExperiment = true;
}
}
},
apollo: {
Expand All @@ -368,7 +388,6 @@ export default {
methods: {
postRegisterSocialForm(event) {
this.$kvTrackEvent('Register', 'click-register-social-cta', 'Complete registration');
this.$kvTrackEvent?.('basket', 'click', 'opt-in-communication', Boolean(this.selectedComms));
this.$v.$touch();
Expand Down

0 comments on commit a1774bc

Please sign in to comment.