Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions site/src/components/PostHogAnalytics.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,10 @@
trackSignupCtaClicked,
trackDownloadButtonClicked,
trackShareButtonClicked,
trackTemplateViewed,
} from '../lib/posthog';

initPostHog();

// Template detail page view
const detailPage = document.querySelector('.template-detail-page');
if (detailPage) {
const name = detailPage.getAttribute('data-template') || '';
const mediaType = detailPage.getAttribute('data-media-type') || '';
if (name) {
trackTemplateViewed(name, mediaType);
}
}

// Global click delegation
document.addEventListener('click', (e) => {
const target = e.target as HTMLElement;
Expand Down
12 changes: 1 addition & 11 deletions site/src/lib/posthog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function initPostHog(): void {
* All tracked events follow the object_verb taxonomy:
* - snake_case
* - past tense verbs
* - e.g. hub:run_button_clicked, hub:template_viewed
* - e.g. hub:run_button_clicked, hub:search_performed
*/
type EventProperties = Record<string, string | number | boolean | undefined>;

Expand Down Expand Up @@ -57,16 +57,6 @@ export function trackShareButtonClicked(templateName: string): void {
});
}

export function trackTemplateViewed(
templateName: string,
mediaType: string,
): void {
capture('hub:template_viewed', {
template_name: templateName,
media_type: mediaType,
});
}

export function trackSearchPerformed(query: string): void {
capture('hub:search_performed', {
query,
Expand Down
Loading