Skip to content

Commit

Permalink
check gtm events
Browse files Browse the repository at this point in the history
  • Loading branch information
TalBenAvi committed May 15, 2024
1 parent 3a11f66 commit 1852a89
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ const NavbarStickyBanner = ({
true
);

const onClose = () => {
const onReadMore = (event: React.MouseEvent) => {
event.stopPropagation();
gtmEvent("Navbar_banner_read_more");
};

const onClose = (event: React.MouseEvent) => {
event.stopPropagation();
gtmEvent("Navbar_banner_close");
setIsOpenStorage(false);
};

const onReadMore = () => gtmEvent("Navbar_banner_read_more");

return (
<ClientOnly>
<Center
Expand All @@ -60,8 +64,8 @@ const NavbarStickyBanner = ({
{text}
</Text>
<Button
onClick={onReadMore}
href={buttonLink}
onClick={onReadMore}
px={4}
py={1}
borderRadius={8}
Expand Down
5 changes: 4 additions & 1 deletion workspaces/website/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,8 @@ export function loadScript(url: string) {
head.appendChild(script);
});
}
export const gtmEvent = (target: string) =>
export const gtmEvent = (target: string) => {
console.log(target);

window.gtag?.("event", target, { event_category: "engagement" });
};

0 comments on commit 1852a89

Please sign in to comment.