Tracking WIP
This commit is contained in:
@@ -5,7 +5,7 @@ import { useCallback, useEffect } from "react"
|
||||
|
||||
import { webviews } from "@/constants/routes/webviews"
|
||||
|
||||
export default function CookieBot() {
|
||||
export default function CookieBotConsent() {
|
||||
const pathName = usePathname()
|
||||
const isWebview = webviews.includes(pathName)
|
||||
const CookiebotCallbackOnAccept = useCallback(() => {
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import Script from "next/script"
|
||||
|
||||
export default function GTMScript() {
|
||||
return (
|
||||
<script
|
||||
<Script
|
||||
id="gtm-script-tag"
|
||||
data-cookieconsent="statistics"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||
|
||||
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||
|
||||
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||
|
||||
'https://analytics.scandichotels.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||
|
||||
})(window,document,'script','adobeDataLayer','GTM-KNJCW67W');
|
||||
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://analytics.scandichotels.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','adobeDataLayer','GTM-KNJCW67W');
|
||||
`,
|
||||
}}
|
||||
async
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client"
|
||||
import NextLink from "next/link"
|
||||
import { usePathname, useRouter, useSearchParams } from "next/navigation"
|
||||
import { startTransition, useCallback, useMemo } from "react"
|
||||
import { usePathname, useSearchParams } from "next/navigation"
|
||||
import { useCallback, useMemo } from "react"
|
||||
|
||||
import { trackClick } from "@/utils/tracking"
|
||||
|
||||
@@ -45,8 +45,6 @@ export default function Link({
|
||||
variant,
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
const fullUrl = useMemo(() => {
|
||||
const search =
|
||||
keepSearchParams && searchParams.size ? `?${searchParams}` : ""
|
||||
@@ -71,20 +69,6 @@ export default function Link({
|
||||
if (trackingId) {
|
||||
trackClickById()
|
||||
}
|
||||
if (props.target === "_blank") {
|
||||
// If link should open in new tab, we don't want to
|
||||
// track navigation nor start a router transition.
|
||||
return
|
||||
}
|
||||
if (href.startsWith("tel:") || href.startsWith("mailto:")) {
|
||||
// If href contains tel or mailto protocols we don't want to
|
||||
// track navigation nor start a router transition.
|
||||
return
|
||||
}
|
||||
e.preventDefault()
|
||||
startTransition(() => {
|
||||
router.push(fullUrl, { scroll })
|
||||
})
|
||||
}}
|
||||
href={fullUrl}
|
||||
id={trackingId}
|
||||
|
||||
Reference in New Issue
Block a user