diff --git a/app/[lang]/Tracking.tsx b/app/[lang]/Tracking.tsx index 0d1c15bbc..9062e63e1 100644 --- a/app/[lang]/Tracking.tsx +++ b/app/[lang]/Tracking.tsx @@ -15,13 +15,22 @@ function createPageObject(trackingData: TrackingData) { .split("/") .filter((v: string) => v) - // Better to get lang from useParams() instead?? ⬆️ - function getSiteSections(segments: string[]) { const sitesections: { [key: string]: string } = {} - // Adobe expects the properties sitesection1 - sitessection6, hence the for-loop below + /* + Adobe expects the properties sitesection1 - sitessection6, hence the for-loop below + The segments ['explore-scandic', 'wifi'] should result in: + { + sitesection1: "explore-scandic", + sitesection2: "explore-scandic|wifi", + sitesection3: "explore-scandic|wifi|", + sitesection4: "explore-scandic|wifi||", + sitesection5: "explore-scandic|wifi|||", + sitesection6: "explore-scandic|wifi||||", + } + */ for (let i = 0; i < 6; i++) { - const key = "value" + (i + 1) + const key = "sitesection" + (i + 1) sitesections[key] = segments.slice(0, i + 1).join("|") if (i > 0 && !segments[i]) { sitesections[key] = sitesections[key].concat(