Skip to content

Commit

Permalink
chore: extended plausible events to include editor (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
deltork authored and joanise committed Oct 18, 2024
1 parent 99ce134 commit 1cf6491
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/studio-web/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Studio
</button>
<button
class="nav__button"
class="nav__button plausible-event-name=Editor"
mat-button
[color]="currentURL === '/editor' ? 'accent' : ''"
[routerLink]="'editor'"
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-web/src/app/editor/editor.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ <h1 i18n="Welcome message for app editor" id="welcome-header">
<div class="row mt-0 justify-content-center">
<button
i18n="Take the tour"
class="mb-4 col-9 center text-center plausible-event-name=Tour"
class="mb-4 col-9 center text-center plausible-event-name=EditorTour"
mat-raised-button
color="primary"
(click)="startTour()"
Expand Down
1 change: 1 addition & 0 deletions packages/studio-web/src/app/editor/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export class EditorComponent implements OnDestroy, OnInit, AfterViewInit {
this.editorService.rasControl$.value,
this.editorService.slots,
this.readalong,
"Editor", //from
);
} else {
this.toastr.error($localize`Download failed.`, $localize`Sorry!`, {
Expand Down
12 changes: 7 additions & 5 deletions packages/studio-web/src/app/shared/download/download.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ Please host all assets on your server, include the font and package imports defi
}
}

registerDownloadEvent(selectedOutputFormat: SupportedOutputs) {
registerDownloadEvent(selectedOutputFormat: SupportedOutputs, from: string) {
const win = window;
(win as any).plausible("Download", {
props: { fileType: selectedOutputFormat },
(win as any).plausible(`Download`, {
props: { fileType: selectedOutputFormat, downloadSource: from },
});
}

Expand Down Expand Up @@ -210,6 +210,7 @@ Please host all assets on your server, include the font and package imports defi
rasXML: Document,
slots: ReadAlongSlots,
readalong: Components.ReadAlong,
from = "Studio",
) {
if (selectedOutputFormat == SupportedOutputs.html) {
var element = document.createElement("a");
Expand All @@ -226,7 +227,7 @@ Please host all assets on your server, include the font and package imports defi
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
this.registerDownloadEvent(selectedOutputFormat);
this.registerDownloadEvent(selectedOutputFormat, from);
} else {
this.toastr.error(
"JS & Fonts Bundle did not get loaded",
Expand Down Expand Up @@ -370,6 +371,7 @@ Use the text editor to paste the snippet below in your WordPress page:
timeOut: 30000,
}),
);
this.registerDownloadEvent(selectedOutputFormat, from);
} else {
let audio: HTMLAudioElement = new Audio(b64Audio);
this.rasService
Expand All @@ -387,7 +389,7 @@ Use the text editor to paste the snippet below in your WordPress page:
});

audio.remove();
this.registerDownloadEvent(selectedOutputFormat);
this.registerDownloadEvent(selectedOutputFormat, from);
}
}

Expand Down

0 comments on commit 1cf6491

Please sign in to comment.