diff --git a/projects/every-voice/src/lib/every-voice.service.ts b/projects/every-voice/src/lib/every-voice.service.ts index c2fe3a83..4a48b63a 100644 --- a/projects/every-voice/src/lib/every-voice.service.ts +++ b/projects/every-voice/src/lib/every-voice.service.ts @@ -204,6 +204,18 @@ export class EveryVoiceService { } console.log("[DEBUG] Audio is playing"); this.status$.next({ id: audioId, status: "PLAYING" }); + //opted into plausible + if ((window as any).plausible) { + try { + const win = window; + + (win as any).plausible(`Used TTS`, { + props: {}, + }); + } catch (err) { + console.error(err); + } + } }; this.audioPlayer.onerror = (event) => { diff --git a/projects/word-weaver/src/app/core/conjugation/conjugation.service.ts b/projects/word-weaver/src/app/core/conjugation/conjugation.service.ts index 4bd06b72..678fd3b4 100644 --- a/projects/word-weaver/src/app/core/conjugation/conjugation.service.ts +++ b/projects/word-weaver/src/app/core/conjugation/conjugation.service.ts @@ -82,6 +82,7 @@ export class ConjugationService { } } }); + this.generatePlausibleEvent(); return conjugations.filter((x) => ["option", "agent", "patient", "root"].every( (k) => @@ -92,6 +93,8 @@ export class ConjugationService { } conjugate$(selection: TableviewerState | WordmakerState) { + this.generatePlausibleEvent(); + return this.conjugations$.pipe( map((conjugations) => this.filterConjugations(conjugations, selection)) ); @@ -139,4 +142,18 @@ export class ConjugationService { }); return { structuredData, uniqueMain, uniqueCol, uniqueRow }; } + private generatePlausibleEvent( + eventName: string = "Conjugate", + eventProps: object = {} + ) { + if ((window as any).plausible) + try { + const win = window; + (win as any).plausible(eventName, { + props: eventProps, + }); + } catch (err) { + console.error(err); + } + } }