Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize Plausible goals #185

Merged
merged 1 commit into from
Nov 24, 2024
Merged
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
4 changes: 3 additions & 1 deletion src/app/concepts/[id]/ProblemRequiresChanges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, { useState } from 'react'
import ConceptForm from '@/components/ConceptForm'
import Paragraph from '@/components/Paragraph'
import Section from '@/components/Section'
import { Goals } from '@/lib/goals'

interface TargetAudience {
segment: string
Expand Down Expand Up @@ -43,8 +44,9 @@ const ProblemRequiresChanges = ({ conceptId, problem, evaluation }: Props) => {
setStatus('loading')
setErrorMessage(null)

plausible('analysis', {
plausible(Goals.Analysis, {
props: {
page: 'ProblemRequiresChanges',
buttonId: 'requires_changes',
},
})
Expand Down
4 changes: 3 additions & 1 deletion src/app/concepts/[id]/WellDefinedProblem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { useState } from 'react'
import Paragraph from '@/components/Paragraph'
import Section from '@/components/Section'
import SimpleUnorderedList from '@/components/SimpleUnorderedList'
import { Goals } from '@/lib/goals'

interface TargetAudience {
segment: string
Expand Down Expand Up @@ -41,8 +42,9 @@ const WellDefinedProblem = ({ conceptId, evaluation }: Props) => {
setStatus('loading')
setErrorMessage(null)

plausible('analysis', {
plausible(Goals.Analysis, {
props: {
page: 'WellDefinedProblem',
buttonId: 'well_defined',
},
})
Expand Down
19 changes: 16 additions & 3 deletions src/app/ideas/[id]/IdeaAnalysisReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import BackToTopButton from '@/components/BackToTopButton'
import FeedbackForm from '@/components/FeedbackForm'
import HorizontalLine from '@/components/HorizontalLine'
import MessageBox from '@/components/MessageBox'
import { Goals } from '@/lib/goals'
import { NavBar } from './components/NavBar'
import SectionActionableNextSteps from './components/SectionActionableNextSteps'
import SectionCompetitors from './components/SectionCompetitors'
Expand Down Expand Up @@ -159,7 +160,7 @@ export const IdeaAnalysisReport = ({ data }: Props) => {
}

try {
plausible('archive_report')
plausible(Goals.ArchiveReport)

const res = await fetch(`/api/ideas/${data.id}`, {
method: 'DELETE',
Expand Down Expand Up @@ -243,7 +244,13 @@ export const IdeaAnalysisReport = ({ data }: Props) => {
{readyForReport ? (
<Link
href={`/api/ideas/${data.id}/pdf`}
onClick={() => plausible('download_pdf')}
onClick={() =>
plausible(Goals.DownloadPDF, {
props: {
buttonId: 'top_button',
},
})
}
target="_blank"
className="rounded bg-blue-600 px-4 py-2 font-semibold text-white hover:bg-blue-700"
>
Expand Down Expand Up @@ -345,7 +352,13 @@ export const IdeaAnalysisReport = ({ data }: Props) => {
{readyForReport ? (
<Link
href={`/api/ideas/${data.id}/pdf`}
onClick={() => plausible('download_pdf')}
onClick={() =>
plausible(Goals.DownloadPDF, {
props: {
buttonId: 'bottom_button',
},
})
}
target="_blank"
className="rounded bg-blue-600 px-4 py-2 font-semibold text-white hover:bg-blue-700"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import BackToTopButton from '@/components/BackToTopButton'
import FeedbackForm from '@/components/FeedbackForm'
import FetchingDataMessage from '@/components/FetchingDataMessage'
import HorizontalLine from '@/components/HorizontalLine'
import { Goals } from '@/lib/goals'
import { NavBar } from './components/NavBar'
import SectionLongFormContent from './components/SectionLongFormContent'
import SectionShortFormContent from './components/SectionShortFormContent'
Expand Down Expand Up @@ -105,7 +106,7 @@ export const SocialMediaCampaigns = ({ data }: Props) => {
setStatus('loading')

try {
plausible('request_social_media_campaigns')
plausible(Goals.RequestSocialMediaCampaigns)

const res = await fetch(`/api/ideas/${data.id}/social_media_campaigns`, {
method: 'POST',
Expand Down
6 changes: 6 additions & 0 deletions src/lib/goals.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum Goals {
Analysis = 'analysis',
DownloadPDF = 'download_pdf',
ArchiveReport = 'archive_report',
RequestSocialMediaCampaigns = 'request_social_media_campaigns',
}
Loading