diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ac47ff6..4c790f8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -19,6 +19,8 @@ concurrency: jobs: build: runs-on: ubuntu-latest + env: + NEXT_PUBLIC_TRACKER_URL: ${{ vars.NEXT_PUBLIC_TRACKER_URL }} steps: - name: Checkout uses: actions/checkout@v4 diff --git a/components/download-section.tsx b/components/download-section.tsx index 8a74f2b..f9ef716 100644 --- a/components/download-section.tsx +++ b/components/download-section.tsx @@ -7,6 +7,7 @@ import { useTranslation } from "react-i18next" const downloads = [ { + id: "mac_intel", icon: Package, key: "macIntel", defaultPlatform: "macOS Intel processors", @@ -16,6 +17,7 @@ const downloads = [ link: "https://dashai.nyc3.cdn.digitaloceanspaces.com/executables/DashAI-launcher-cpu-x86_64", }, { + id: "mac_arm", icon: Package, key: "macArm", defaultPlatform: "macOS ARM processors", @@ -25,6 +27,7 @@ const downloads = [ link: "https://dashai.nyc3.cdn.digitaloceanspaces.com/executables/DashAI-launcher-cpu-arm64", }, { + id: "windows", icon: Package, key: "windows", defaultPlatform: "Windows", @@ -35,6 +38,19 @@ const downloads = [ }, ] +const TRACKER_URL = process.env.NEXT_PUBLIC_TRACKER_URL + +async function trackClick(buttonId: string) { + if (!TRACKER_URL) return + try { + await fetch(`${TRACKER_URL}/click/${buttonId}`, { + method: "POST", + }) + } catch { + // non-blocking — don't let tracking errors affect the download + } +} + export function DownloadSection() { const { t } = useTranslation() return ( @@ -57,7 +73,7 @@ export function DownloadSection() {
- {downloads.map((download, index) => { + {downloads.map((download) => { const Icon = download.icon const platform = t(`download:cards.${download.key}.platform`, { defaultValue: download.defaultPlatform, @@ -81,12 +97,12 @@ export function DownloadSection() {

{format}

-
) -} +} \ No newline at end of file