Skip to content

Commit

Permalink
✨ Feat(owner): add matomo events on property
Browse files Browse the repository at this point in the history
  • Loading branch information
mattboll committed Jul 22, 2024
1 parent db0a556 commit 23f8f74
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 6 deletions.
2 changes: 2 additions & 0 deletions owner/src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UtilsService from "../services/UtilsService";
import useOwnerStore from "../store/owner-store";
import GmbiAd from "./GmbiAd.vue";
import FeedbackRequest from "./FeedbackRequest.vue";
import AnalyticsService from "../services/AnalyticsService";
const store = useOwnerStore();
const { t } = useI18n();
Expand All @@ -23,6 +24,7 @@ function addProperty() {
}
function consultProperty(id: number) {
AnalyticsService.propertyData('visit');
router.push({ name: "ConsultProperty", params: { id } });
}
Expand Down
17 changes: 15 additions & 2 deletions owner/src/components/property/ConsultProperty.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<button
:title="t('consultproperty.share-btn')"
class="fr-btn btn--white fr-btn--secondary"
@click="shareBtnClicked()"
>
{{ t('consultproperty.share-btn') }}
</button>
Expand Down Expand Up @@ -55,7 +56,7 @@
<button
:title="t('consultproperty.delete-btn')"
class="fr-btn btn--white fr-btn--secondary"
@click="confirmDeleteProperty = true"
@click="showDeletePropertyModal()"
>
{{ t('consultproperty.delete-property') }}
</button>
Expand Down Expand Up @@ -292,6 +293,10 @@ function getTenants(): Applicant[] {
});
}
function shareBtnClicked() {
AnalyticsService.propertyData('partager');
}
onMounted(async () => {
if (route.params.id) {
id.value = Number(route.params.id);
Expand Down Expand Up @@ -326,6 +331,7 @@ const titleKey = computed(() => {
});
function editProperty() {
AnalyticsService.propertyData('modifier');
router.push({ name: 'PropertyName', params: { id: id.value } });
}
Expand All @@ -338,13 +344,20 @@ function sortTable(col: string) {
}
}
function showDeletePropertyModal() {
confirmDeleteProperty.value = true;
AnalyticsService.propertyData('supprimer');
}
function validDeleteFile() {
AnalyticsService.propertyData('supprimer_valider');
store.deleteProperty(id.value).then(() => {
router.push({ name: 'Dashboard' });
});
confirmDeleteProperty.value = false;
}
function undoDeleteFile() {
AnalyticsService.propertyData('supprimer_annuler');
confirmDeleteProperty.value = false;
}
function validDeleteApplicants() {
Expand All @@ -360,7 +373,7 @@ function undoDeleteApplicants() {
}
function copyToken() {
AnalyticsService.copyLink();
AnalyticsService.propertyData("partager_copylink");
navigator.clipboard.writeText(token.value);
toast.success(t('consultproperty.link-copied').toString(), {
timeout: 7000,
Expand Down
2 changes: 2 additions & 0 deletions owner/src/components/property/PropertyAddress.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import NakedCard from 'df-shared-next/src/components/NakedCard.vue';
import UtilsService from '../../services/UtilsService';
import PropertyPage from './PropertyPage.vue';
import useOwnerStore from '../../store/owner-store';
import AnalyticsService from '../../services/AnalyticsService';
const { t } = useI18n();
Expand Down Expand Up @@ -43,6 +44,7 @@ const address = computed({
});
function onSubmit() {
AnalyticsService.propertyData('adresse_register');
store.saveProperty().then(() => {
router.push({
name: 'PropertyFurniture',
Expand Down
2 changes: 2 additions & 0 deletions owner/src/components/property/PropertyFurniture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Field, ErrorMessage } from 'vee-validate';
import NakedCard from 'df-shared-next/src/components/NakedCard.vue';
import PropertyPage from './PropertyPage.vue';
import useOwnerStore from '../../store/owner-store';
import AnalyticsService from '../../services/AnalyticsService';
const { t } = useI18n();
Expand All @@ -29,6 +30,7 @@ const furniture = computed({
});
function onSubmit() {
AnalyticsService.propertyData('ameublement_register');
store.saveProperty().then((data) => {
router.push({ name: 'PropertyLivingSpace', params: { id: data.id } });
});
Expand Down
2 changes: 2 additions & 0 deletions owner/src/components/property/PropertyLivingSpace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import useOwnerStore from '../../store/owner-store';
import PropertyPage from './PropertyPage.vue';
import AnalyticsService from '../../services/AnalyticsService';
const { t } = useI18n();
Expand All @@ -29,6 +30,7 @@ const livingSpace = computed({
});
function onSubmit() {
AnalyticsService.propertyData('surface_register');
store.saveProperty().then(() => {
router.push({ name: 'PropertyRent', params: { id: store.getPropertyToEdit.id } });
});
Expand Down
2 changes: 2 additions & 0 deletions owner/src/components/property/PropertyName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import useOwnerStore from '../../store/owner-store';
import PropertyPage from './PropertyPage.vue';
import AnalyticsService from '../../services/AnalyticsService';
const { t } = useI18n();
Expand All @@ -29,6 +30,7 @@ const name = computed({
});
function onSubmit() {
AnalyticsService.propertyData('nom_register');
store.saveProperty().then((data) => {
router.push({ name: 'PropertyType', params: { id: data.id } });
});
Expand Down
2 changes: 2 additions & 0 deletions owner/src/components/property/PropertyRent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useI18n } from 'vue-i18n';
import { useRoute, useRouter } from 'vue-router';
import useOwnerStore from '../../store/owner-store';
import PropertyPage from './PropertyPage.vue';
import AnalyticsService from '../../services/AnalyticsService';
const { t } = useI18n();
Expand Down Expand Up @@ -38,6 +39,7 @@ const charges = computed({
});
function onSubmit() {
AnalyticsService.propertyData('honor_declaration_validate');
store.saveProperty().then(() => {
router.push({ name: 'PropertyDiagnostic', params: { id: store.getPropertyToEdit.id } });
});
Expand Down
2 changes: 2 additions & 0 deletions owner/src/components/property/PropertyType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useRoute, useRouter } from 'vue-router';
import { Field, ErrorMessage } from 'vee-validate';
import PropertyPage from './PropertyPage.vue';
import useOwnerStore from '../../store/owner-store';
import AnalyticsService from '../../services/AnalyticsService';
const { t } = useI18n();
Expand All @@ -29,6 +30,7 @@ const type = computed({
});
function onSubmit() {
AnalyticsService.propertyData('type_register');
store.saveProperty().then((data) => {
router.push({ name: 'PropertyAddress', params: { id: data.id } });
});
Expand Down
8 changes: 4 additions & 4 deletions owner/src/services/AnalyticsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ const AnalyticsService = {
event_category: 'owner',
});
},
copyLink() {
this.sendEvent('copy-link', {
propertyData(data: string) {
this.sendEvent('property_' + data, {
event_category: 'property',
});
},
})
}
};

export default AnalyticsService;

0 comments on commit 23f8f74

Please sign in to comment.