From 6dd151345b660d230abb471c3220f82d068659cc Mon Sep 17 00:00:00 2001 From: naari3 Date: Sun, 29 Nov 2020 19:06:44 +0900 Subject: [PATCH] More events --- components/Pager.tsx | 6 ++++++ components/Tag.tsx | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/components/Pager.tsx b/components/Pager.tsx index 0a2090f..547ee3f 100644 --- a/components/Pager.tsx +++ b/components/Pager.tsx @@ -9,6 +9,7 @@ import { import removeEmpty from "../lib/removeEmpty"; import { UrlObject } from "url"; import { actualMaxPageNumber } from "../lib/pager"; +import * as gtag from "../lib/gtag"; type Url = string | UrlObject; @@ -29,6 +30,11 @@ const PagerButton: FC = ({ href, children }) => { { + gtag.event({ + action: "pager", + category: "Otomads", + label: "happy", + }); loadingDispatch({ type: "update", payload: true, diff --git a/components/Tag.tsx b/components/Tag.tsx index f84fa09..90cbe59 100644 --- a/components/Tag.tsx +++ b/components/Tag.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import { useGlobalState as useSearchGlobalState } from "../contexts/SearchContext"; import { useGlobalState as useLoadingGlobalState } from "../contexts/LoadingContext"; import removeEmpty from "../lib/removeEmpty"; +import * as gtag from "../lib/gtag"; const Tag = React.memo(({ name }: { name: string }) => { const loading = useLoadingGlobalState(); @@ -18,7 +19,19 @@ const Tag = React.memo(({ name }: { name: string }) => { query: removeEmpty({ ...options, page: 1, q: name }), }} > - {name} + { + gtag.event({ + action: "clickTag", + category: "Otomads", + label: "happy", + value: name, + }); + }} + > + {name} + ); });