From 4b9fa3f0d00f3d3cc7dc8c92575bf58cbd2e151e Mon Sep 17 00:00:00 2001 From: David Montero Crespo Date: Sun, 9 Aug 2026 08:16:47 +0200 Subject: [PATCH] feat(datasheet): Product-page links carry UTM attribution and report the click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both Buy renderers (picker hover panel + Part Inspector) now append utm_source=velxio&utm_medium=simulator&utm_campaign=datasheet with the component id in utm_content, so vendors can attribute the referral. trackProductPageClick fires the GA4 event and dispatches a 'velxio:product-page-click' CustomEvent — an overlay build can persist the click server-side without this tree knowing about it. --- .../src/components/ComponentInfoPanel.tsx | 11 +++++++++-- frontend/src/components/componentDocs.ts | 19 +++++++++++++++++++ .../simulator/PartInspectorDialog.tsx | 7 ++++++- frontend/src/utils/analytics.ts | 18 ++++++++++++++++++ 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/ComponentInfoPanel.tsx b/frontend/src/components/ComponentInfoPanel.tsx index 7ab7cb19..2902a796 100644 --- a/frontend/src/components/ComponentInfoPanel.tsx +++ b/frontend/src/components/ComponentInfoPanel.tsx @@ -24,7 +24,8 @@ import { useTranslation } from 'react-i18next'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import type { PropertyDescriptor } from '../types/component-metadata'; -import { loadDoc, type ComponentDoc } from './componentDocs'; +import { loadDoc, productPageHref, type ComponentDoc } from './componentDocs'; +import { trackProductPageClick } from '../utils/analytics'; import './ComponentInfoPanel.css'; export interface PanelData { @@ -168,7 +169,13 @@ export const ComponentInfoBody: React.FC<{ {buyHref && (
- + trackProductPageClick(data.id, doc?.brand, buyHref)} + > = ({
+ trackProductPageClick(componentMetadata.id, doc?.brand, buyHref) + } >