Skip to content

Commit

Permalink
feat: precision metrics par producteur matomo (#505)
Browse files Browse the repository at this point in the history
* feat: precision metrics par producteur matomo

* fix: keep matomo metrics global
  • Loading branch information
abelkhay committed Mar 27, 2024
1 parent c65ef8a commit dd21a2b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
role="button"
type="button"
class="btn btn-tile px-md-0 py-md-4 p-2 d-flex flex-md-column flex-row"
(click)="sendByEmail.emit($event)">
(click)="sendByEmail.emit($event); onSendEmailFromActionButton()">
<span class="ri-circled bg-primary text-light fw-normal">
<span role="img" class="ri-mail-send-line" aria-hidden="true"></span>
</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Optional, Output } from '@angular/core';
import { SourcePresentation } from '@features/cartographie/presenters';
import { MatomoTracker } from 'ngx-matomo';
import { environment } from 'projects/client-application/src/environments/environment';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
Expand All @@ -11,13 +13,27 @@ export class BoutonsActionComponent {

@Input() public priseRdv: string | undefined;

@Input() public sources: SourcePresentation[] | undefined;

@Output() public sendByEmail: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>();

@Output() public openImpressionChoiceModal: EventEmitter<MouseEvent> = new EventEmitter<MouseEvent>();

public constructor(@Optional() private readonly _matomoTracker?: MatomoTracker) {}

public onPrintFromActionButton(): void {
this._matomoTracker?.trackEvent('fiche d茅tail', 'bouton action', `impression fiche`);
if (environment.production) {
this._matomoTracker?.trackEvent('fiche d茅tail', 'bouton action', `impression fiche`);
const sourceLabels = this.sources?.map((source) => source.label).join(', ');
this._matomoTracker?.trackEvent('fiche d茅tail', sourceLabels ?? 'Source inconnue', `bouton action - impression fiche`);
}
}

public onSendEmailFromActionButton(): void {
if (environment.production) {
this._matomoTracker?.trackEvent('fiche d茅tail', 'bouton action', `envoyer par email`);
const sourceLabels = this.sources?.map((source) => source.label).join(', ');
this._matomoTracker?.trackEvent('fiche d茅tail', sourceLabels ?? 'Source inconnue', `bouton action - envoyer par email`);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<app-boutons-action
[siteWeb]="lieuMediationNumerique.contact?.site_web"
[priseRdv]="lieuMediationNumerique.prise_rdv"
[sources]="lieuMediationNumerique.source"
(openImpressionChoiceModal)="impressionChoiceModal.control.toggle($event)"
(sendByEmail)="sendByEmailModal.control.toggle($event)"></app-boutons-action>
<div class="p-4 bg-tertiary d-flex align-items-center" *ngIf="lieuMediationNumerique.prive">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { OrientationSheetForm, SendLieuByEmail } from '../../models';
import { FilterPresentation } from '../../../core/presenters';
import { FormGroup } from '@angular/forms';
import { MatomoTracker } from 'ngx-matomo';
import { environment } from 'projects/client-application/src/environments/environment';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down Expand Up @@ -55,6 +56,10 @@ export class LieuxMediationNumeriqueDetailsComponent {
};

public onPrintFromBandeau(): void {
this._matomoTracker?.trackEvent('fiche d茅tail', 'bandeau footer', `impression fiche`);
if (environment.production) {
this._matomoTracker?.trackEvent('fiche d茅tail', 'bandeau footer', `impression fiche`);
const sourceLabels = this.lieuMediationNumerique.source?.map((source) => source.label).join(', ');
this._matomoTracker?.trackEvent('fiche d茅tail', sourceLabels ?? 'Source inconnue', 'bandeau footer - impression fiche');
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MatomoTracker } from 'ngx-matomo';
import { ConditionAcces, LabelNational } from '@gouvfr-anct/lieux-de-mediation-numerique';
import { ASSETS_TOKEN, AssetsConfiguration } from '../../../../../root';
import { labelToDisplayMap, LieuMediationNumeriqueListItemPresentation } from '../../../presenters';
import { environment } from 'projects/client-application/src/environments/environment';

@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
Expand Down Expand Up @@ -34,7 +35,9 @@ export class LieuMediationNumeriqueListItemComponent {
}

public showDetails(lieu: LieuMediationNumeriqueListItemPresentation): void {
this._matomoTracker?.trackEvent('Fiches', 'D茅but', `Ouverture de fiches - ${lieu.id}`);
if (environment.production) {
this._matomoTracker?.trackEvent('Fiches', 'D茅but', `Ouverture de fiches - ${lieu.id}`);
}
}

public toLabelNom(label: LabelNational): string | undefined {
Expand Down

0 comments on commit dd21a2b

Please sign in to comment.