Skip to content

Commit 5a7454d

Browse files
authored
Merge pull request #18 from meshcloud/feature/fix-and-improvement
chore: Add plausible support
2 parents e51ce28 + bd0432f commit 5a7454d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

website/src/app/app.component.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { CommonModule } from '@angular/common';
2-
import { Component } from '@angular/core';
1+
import { CommonModule, isPlatformBrowser } from '@angular/common';
2+
import { Component, Inject, PLATFORM_ID } from '@angular/core';
33
import { RouterOutlet } from '@angular/router';
44
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
55

@@ -14,5 +14,18 @@ import { FooterComponent } from './shared/footer';
1414
standalone: true
1515
})
1616
export class AppComponent {
17+
constructor(@Inject(PLATFORM_ID) private platformId: Object) {
18+
this.loadPlausible();
19+
}
1720

21+
loadPlausible() {
22+
// Ensure we are in the browser (not SSR)
23+
if (isPlatformBrowser(this.platformId)) {
24+
const script = document.createElement('script');
25+
script.src = 'https://plausible.cluster.dev.meshcloud.io/js/script.js';
26+
script.setAttribute('data-domain', 'hub.meshcloud.io');
27+
script.defer = true;
28+
document.head.appendChild(script);
29+
}
30+
}
1831
}

0 commit comments

Comments
 (0)