From 6b325702b10944935fdb4fde39aa79bf7924d605 Mon Sep 17 00:00:00 2001 From: 9a0ffedc5b31823b Date: Sat, 2 May 2026 22:41:33 +0000 Subject: [PATCH] feat: add coolify deployment and meta tracking --- README.md | 37 ++++++++++++-- nixpacks.toml | 12 +++++ package.json | 1 + src/components/ContactButtons.astro | 24 ++++----- src/components/MetaPixel.astro | 75 +++++++++++++++++++++++++++-- src/layouts/BaseLayout.astro | 2 +- src/lib/meta.ts | 54 +++++++++++++++++++++ src/pages/api/meta-capi.ts | 11 +++-- src/pages/automobiliai/[slug].astro | 6 +-- src/pages/kontaktai.astro | 32 +++++++++++- tests/deploy.test.ts | 20 ++++++++ tests/meta.test.ts | 63 ++++++++++++++++++++++++ tsconfig.json | 3 +- 13 files changed, 308 insertions(+), 32 deletions(-) create mode 100644 nixpacks.toml create mode 100644 src/lib/meta.ts create mode 100644 tests/deploy.test.ts create mode 100644 tests/meta.test.ts diff --git a/README.md b/README.md index 8ace152..f9b908b 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ npm install npm run dev npm test npm run build +npm run start ``` ## Add A New Car @@ -40,13 +41,41 @@ Sold cars are hidden by default. To show a sold section on the homepage, set `sh ## Meta Pixel -Set `META_PIXEL_ID` in your Vercel environment variables. Leave it empty locally if the pixel should not load. +Set `PUBLIC_META_PIXEL_ID` in Coolify or Vercel environment variables. `META_PIXEL_ID` is also supported for build-time compatibility. Leave both empty locally if the pixel should not load. -Phone and WhatsApp buttons fire a `Contact` event when the pixel is configured. `src/pages/api/meta-capi.ts` is only a static stub for a future server-side Conversions API function. +Tracking setup: + +1. `PageView` fires on every route with a unique `eventID` and page context. +2. Phone and WhatsApp buttons fire `Contact` with `content_name`, `content_ids`, `contact_channel`, `currency`, and `value` when listing data is available. +3. The sell-car form fires `Lead` on submit when a form endpoint is configured. +4. Events also push to `window.dataLayer` for future Google Tag Manager or debugging. +5. A `