feat(SW-392): Added tab navigation click tracking
This commit is contained in:
@@ -13,7 +13,7 @@ export default function ButtonLink({
|
|||||||
target,
|
target,
|
||||||
trackingId,
|
trackingId,
|
||||||
trackingParams,
|
trackingParams,
|
||||||
onClick,
|
onClick = () => {},
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}: ButtonLinkProps) {
|
}: ButtonLinkProps) {
|
||||||
return (
|
return (
|
||||||
@@ -22,9 +22,7 @@ export default function ButtonLink({
|
|||||||
href={href}
|
href={href}
|
||||||
target={target}
|
target={target}
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
if (onClick) {
|
onClick(e)
|
||||||
onClick(e)
|
|
||||||
}
|
|
||||||
if (trackingId) {
|
if (trackingId) {
|
||||||
trackClick(trackingId, trackingParams)
|
trackClick(trackingId, trackingParams)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import Link from "@/components/TempDesignSystem/Link"
|
|||||||
import useHash from "@/hooks/useHash"
|
import useHash from "@/hooks/useHash"
|
||||||
import useScrollSpy from "@/hooks/useScrollSpy"
|
import useScrollSpy from "@/hooks/useScrollSpy"
|
||||||
import useStickyPosition from "@/hooks/useStickyPosition"
|
import useStickyPosition from "@/hooks/useStickyPosition"
|
||||||
|
import { trackHotelTabClick } from "@/utils/tracking"
|
||||||
|
|
||||||
import styles from "./tabNavigation.module.css"
|
import styles from "./tabNavigation.module.css"
|
||||||
|
|
||||||
@@ -95,7 +96,10 @@ export default function TabNavigation({
|
|||||||
color="burgundy"
|
color="burgundy"
|
||||||
textDecoration="none"
|
textDecoration="none"
|
||||||
scroll={true}
|
scroll={true}
|
||||||
onClick={pauseScrollSpy}
|
onClick={() => {
|
||||||
|
pauseScrollSpy()
|
||||||
|
trackHotelTabClick(link.text)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{link.text}
|
{link.text}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
|
|
||||||
--hotel-page-navigation-height: 59px;
|
--hotel-page-navigation-height: 59px;
|
||||||
--hotel-page-scroll-margin-top: calc(
|
--hotel-page-scroll-margin-top: calc(
|
||||||
var(--hotel-page-navigation-height) + var(--Spacing-x2)
|
var(--hotel-page-navigation-height) + var(--booking-widget-mobile-height) +
|
||||||
|
var(--Spacing-x2)
|
||||||
);
|
);
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
.overview {
|
.overview {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: var(--Spacing-x3);
|
gap: var(--Spacing-x3);
|
||||||
|
scroll-margin-top: var(--hotel-page-scroll-margin-top);
|
||||||
}
|
}
|
||||||
|
|
||||||
.introContainer {
|
.introContainer {
|
||||||
@@ -44,7 +46,6 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
gap: var(--Spacing-x4);
|
gap: var(--Spacing-x4);
|
||||||
scroll-margin-top: var(--hotel-page-scroll-margin-top);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.alertsContainer {
|
.alertsContainer {
|
||||||
@@ -65,6 +66,10 @@
|
|||||||
|
|
||||||
@media screen and (min-width: 1367px) {
|
@media screen and (min-width: 1367px) {
|
||||||
.pageContainer {
|
.pageContainer {
|
||||||
|
--hotel-page-scroll-margin-top: calc(
|
||||||
|
var(--hotel-page-navigation-height) + var(--booking-widget-desktop-height) +
|
||||||
|
var(--Spacing-x2)
|
||||||
|
);
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"header mapContainer"
|
"header mapContainer"
|
||||||
"tabNavigation mapContainer"
|
"tabNavigation mapContainer"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export default function useScrollSpy(
|
|||||||
// Make sure only to activate the section when it reaches the top of the viewport.
|
// Make sure only to activate the section when it reaches the top of the viewport.
|
||||||
// A negative value for rootMargin shrinks the root bounding box inward,
|
// A negative value for rootMargin shrinks the root bounding box inward,
|
||||||
// meaning elements will only be considered intersecting when they are further inside the viewport.
|
// meaning elements will only be considered intersecting when they are further inside the viewport.
|
||||||
rootMargin: "-8% 0% -90% 0%",
|
rootMargin: "-15% 0% -85% 0%",
|
||||||
threshold: 0,
|
threshold: 0,
|
||||||
...options,
|
...options,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -77,6 +77,16 @@ export function trackAccordionClick(option: string) {
|
|||||||
pushToDataLayer(event)
|
pushToDataLayer(event)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function trackHotelTabClick(name: string) {
|
||||||
|
pushToDataLayer({
|
||||||
|
event: "linkClick",
|
||||||
|
link: {
|
||||||
|
action: "hotel menu click",
|
||||||
|
option: `hotel menu:${name}`,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function trackUpdatePaymentMethod(hotelId: string, method: string) {
|
export function trackUpdatePaymentMethod(hotelId: string, method: string) {
|
||||||
const paymentSelectionEvent = {
|
const paymentSelectionEvent = {
|
||||||
event: "paymentSelection",
|
event: "paymentSelection",
|
||||||
|
|||||||
Reference in New Issue
Block a user