feat: wire affiliate_link_clicked event in product detail page
This commit is contained in:
@@ -6,6 +6,7 @@ import { useParams, useRouter, useSearchParams } from "next/navigation";
|
|||||||
|
|
||||||
import type { BuilderSlotKey } from "@/types/builderSlots";
|
import type { BuilderSlotKey } from "@/types/builderSlots";
|
||||||
import { PART_ROLE_TO_CATEGORY, normalizePartRole } from "@/lib/catalogMappings";
|
import { PART_ROLE_TO_CATEGORY, normalizePartRole } from "@/lib/catalogMappings";
|
||||||
|
import { trackAffiliateLinkClicked } from "@/lib/analytics";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API Shapes
|
* API Shapes
|
||||||
@@ -699,6 +700,7 @@ export default function ProductDetailsPage() {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="inline-flex items-center justify-center rounded-md bg-amber-400 px-3 py-1.5 text-xs font-semibold text-black hover:bg-amber-300"
|
className="inline-flex items-center justify-center rounded-md bg-amber-400 px-3 py-1.5 text-xs font-semibold text-black hover:bg-amber-300"
|
||||||
|
onClick={() => trackAffiliateLinkClicked(product?.name ?? "", o.merchantName ?? "")}
|
||||||
>
|
>
|
||||||
Buy
|
Buy
|
||||||
</a>
|
</a>
|
||||||
@@ -726,6 +728,7 @@ export default function ProductDetailsPage() {
|
|||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
className="rounded-md border border-zinc-700 bg-zinc-900/70 px-4 py-2 text-sm font-semibold text-zinc-200 hover:bg-zinc-800"
|
className="rounded-md border border-zinc-700 bg-zinc-900/70 px-4 py-2 text-sm font-semibold text-zinc-200 hover:bg-zinc-800"
|
||||||
|
onClick={() => trackAffiliateLinkClicked(product?.name ?? "", merchantLabel(bestOffer))}
|
||||||
>
|
>
|
||||||
Buy from {merchantLabel(bestOffer)} →
|
Buy from {merchantLabel(bestOffer)} →
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user