From ad58f4f567f60619f7f09cc552328fd98ca2bcb7 Mon Sep 17 00:00:00 2001 From: Yasuaki Uechi Date: Thu, 7 Oct 2021 19:03:51 +0900 Subject: [PATCH] chore: omit ga --- package.json | 5 +-- public/index.html | 6 +++ src/components/Footer.tsx | 65 +++++++++++++-------------- src/components/cards/core.tsx | 9 +--- src/index.tsx | 8 +--- src/util/analytics.ts | 47 +++++++------------ yarn.lock | 85 +++++++++++++++++------------------ 7 files changed, 101 insertions(+), 124 deletions(-) diff --git a/package.json b/package.json index 7b0eb68..366bf39 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "test": "jest --coverage && CI=true react-scripts test --coverage" }, "dependencies": { - "@sentry/browser": "^6.13.2", + "@sentry/browser": "^6.13.3", "cross-fetch": "^3.1.4", "easy-peasy": "^5.0.3", "fetch-suspense": "^1.2.2", @@ -25,7 +25,6 @@ "rc-tooltip": "^5.1.1", "react": "^17.0.2", "react-dom": "^17.0.2", - "react-ga": "^3.3.0", "react-helmet": "^6.0.0", "react-i18next": "11.12.0", "react-icons": "^4.3.1", @@ -49,7 +48,7 @@ "@types/node": "^16.10.3", "@types/react-dom": "^17.0.9", "@types/react-helmet": "^6.1.3", - "@types/react-router-dom": "^5.3.0", + "@types/react-router-dom": "^5.3.1", "@types/styled-components": "^5.1.14", "@types/validator": "^13.6.3", "@vercel/build-utils": "^2.12.2", diff --git a/public/index.html b/public/index.html index 5c69fcf..581bb73 100644 --- a/public/index.html +++ b/public/index.html @@ -54,6 +54,12 @@ href="https://fonts.googleapis.com/css?family=Montserrat:600&display=swap" rel="stylesheet" /> + namae diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index 7778e21..7865abe 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -1,5 +1,4 @@ import React from 'react'; -import { OutboundLink } from 'react-ga'; import { useTranslation } from 'react-i18next'; import { FaGithub, FaProductHunt, FaTwitter } from 'react-icons/fa'; import { GoHeart } from 'react-icons/go'; @@ -57,34 +56,34 @@ const Community = () => { {t('community')} @@ -110,54 +109,54 @@ const About = () => { ☕️ {' '} by{' '} - Yasuaki Uechi - +

- - - + - - + - - + Sponsor - + diff --git a/src/components/cards/core.tsx b/src/components/cards/core.tsx index 6504997..abe045d 100644 --- a/src/components/cards/core.tsx +++ b/src/components/cards/core.tsx @@ -1,7 +1,6 @@ import useFetch from 'fetch-suspense'; import Tooltip from 'rc-tooltip'; import React, { Suspense, useEffect, useState } from 'react'; -import { OutboundLink } from 'react-ga'; import { useTranslation } from 'react-i18next'; import { GoInfo } from 'react-icons/go'; import { IoIosFlash } from 'react-icons/io'; @@ -216,13 +215,9 @@ export const Result: React.FC<{ {icon} {link ? ( - + {content} - + ) : ( content )} diff --git a/src/index.tsx b/src/index.tsx index 4d7781a..18d4486 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,7 +9,7 @@ import 'react-toastify/dist/ReactToastify.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; import { store, wrapHistoryWithStoreHandler } from './store'; -import { initSentry, wrapHistoryWithGA } from './util/analytics'; +import { initSentry } from './util/analytics'; import { compose } from './util/array'; import { initCrisp } from './util/crisp'; import './util/i18n'; @@ -18,11 +18,7 @@ import { FullScreenSuspense } from './util/suspense'; initSentry(); initCrisp(); -const history = compose( - createBrowserHistory(), - wrapHistoryWithStoreHandler, - wrapHistoryWithGA -); +const history = compose(createBrowserHistory(), wrapHistoryWithStoreHandler); ReactDOM.render( diff --git a/src/util/analytics.ts b/src/util/analytics.ts index 263ebf5..9ca7bde 100644 --- a/src/util/analytics.ts +++ b/src/util/analytics.ts @@ -1,59 +1,46 @@ -import ReactGA from 'react-ga'; import * as Sentry from '@sentry/browser'; -import { History } from 'history'; const isProduction = process.env.NODE_ENV !== 'development'; -export function wrapHistoryWithGA(history: History) { - if (isProduction) { - ReactGA.initialize('UA-28919359-15'); - ReactGA.pageview(window.location.pathname + window.location.search); - history.listen((location) => { - ReactGA.pageview(location.pathname + location.search); - }); - } - return history; +declare namespace umami { + var trackEvent: ( + value: string, + type: string, + url?: string, + websiteId?: string + ) => void; } export function trackEvent({ - category, - action, - label = undefined, - value = undefined, + value, + type = 'custom', }: { - category: string; - action: string; - label?: string; - value?: number; + value: string; + type?: string; }) { if (isProduction) { - ReactGA.event({ - category, - action, - label, - value, - }); + umami.trackEvent(value, type); } } export function sendQueryEvent(query: string): void { - trackEvent({ category: 'Search', action: 'Invoke New Search', label: query }); + trackEvent({ value: 'Invoke new search', type: 'search' }); } export function sendGettingStartedEvent(): void { - trackEvent({ category: 'Search', action: 'Getting Started' }); + trackEvent({ value: 'Click getting started button', type: 'search' }); } export function sendExpandEvent(): void { - trackEvent({ category: 'Result', action: 'Expand Card' }); + trackEvent({ value: 'Expand card', type: 'search' }); } export function sendAcceptSuggestionEvent(): void { - trackEvent({ category: 'Suggestion', action: 'Accept' }); + trackEvent({ value: 'Accept suggestion', type: 'suggest' }); } export function sendShuffleSuggestionEvent(): void { - trackEvent({ category: 'Suggestion', action: 'Shuffle' }); + trackEvent({ value: 'Shuffle suggestion', type: 'suggest' }); } export function initSentry(): void { diff --git a/yarn.lock b/yarn.lock index ec0c752..bbd0a3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1633,14 +1633,14 @@ estree-walker "^1.0.1" picomatch "^2.2.2" -"@sentry/browser@^6.13.2": - version "6.13.2" - resolved "https://registry.npmjs.org/@sentry/browser/-/browser-6.13.2.tgz#8b731ecf8c3cdd92a4b6893a26f975fd5844056d" - integrity sha512-bkFXK4vAp2UX/4rQY0pj2Iky55Gnwr79CtveoeeMshoLy5iDgZ8gvnLNAz7om4B9OQk1u7NzLEa4IXAmHTUyag== +"@sentry/browser@^6.13.3": + version "6.13.3" + resolved "https://registry.npmjs.org/@sentry/browser/-/browser-6.13.3.tgz#d4511791b1e484ad48785eba3bce291fdf115c1e" + integrity sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ== dependencies: - "@sentry/core" "6.13.2" - "@sentry/types" "6.13.2" - "@sentry/utils" "6.13.2" + "@sentry/core" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" tslib "^1.9.3" "@sentry/cli@^1.69.1": @@ -1655,46 +1655,46 @@ progress "^2.0.3" proxy-from-env "^1.1.0" -"@sentry/core@6.13.2": - version "6.13.2" - resolved "https://registry.npmjs.org/@sentry/core/-/core-6.13.2.tgz#2ce164f81667aa89cd116f807d772b4718434583" - integrity sha512-snXNNFLwlS7yYxKTX4DBXebvJK+6ikBWN6noQ1CHowvM3ReFBlrdrs0Z0SsSFEzXm2S4q7f6HHbm66GSQZ/8FQ== +"@sentry/core@6.13.3": + version "6.13.3" + resolved "https://registry.npmjs.org/@sentry/core/-/core-6.13.3.tgz#5cbbb995128e793ebebcbf1d3b7514e0e5e8b221" + integrity sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA== dependencies: - "@sentry/hub" "6.13.2" - "@sentry/minimal" "6.13.2" - "@sentry/types" "6.13.2" - "@sentry/utils" "6.13.2" + "@sentry/hub" "6.13.3" + "@sentry/minimal" "6.13.3" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" tslib "^1.9.3" -"@sentry/hub@6.13.2": - version "6.13.2" - resolved "https://registry.npmjs.org/@sentry/hub/-/hub-6.13.2.tgz#ebc66fd55c96c7686a53ffd3521b6a63f883bb79" - integrity sha512-sppSuJdNMiMC/vFm/dQowCBh11uTrmvks00fc190YWgxHshodJwXMdpc+pN61VSOmy2QA4MbQ5aMAgHzPzel3A== +"@sentry/hub@6.13.3": + version "6.13.3" + resolved "https://registry.npmjs.org/@sentry/hub/-/hub-6.13.3.tgz#cc09623a69b5343315fdb61c7fdd0be74b72299f" + integrity sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw== dependencies: - "@sentry/types" "6.13.2" - "@sentry/utils" "6.13.2" + "@sentry/types" "6.13.3" + "@sentry/utils" "6.13.3" tslib "^1.9.3" -"@sentry/minimal@6.13.2": - version "6.13.2" - resolved "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.13.2.tgz#de3ecc62b9463bf56ccdbcf4c75f7ea1aeeebc11" - integrity sha512-6iJfEvHzzpGBHDfLxSHcGObh73XU1OSQKWjuhDOe7UQDyI4BQmTfcXAC+Fr8sm8C/tIsmpVi/XJhs8cubFdSMw== +"@sentry/minimal@6.13.3": + version "6.13.3" + resolved "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.13.3.tgz#a675a79bcc830142e4f95e6198a2efde2cd3901e" + integrity sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw== dependencies: - "@sentry/hub" "6.13.2" - "@sentry/types" "6.13.2" + "@sentry/hub" "6.13.3" + "@sentry/types" "6.13.3" tslib "^1.9.3" -"@sentry/types@6.13.2": - version "6.13.2" - resolved "https://registry.npmjs.org/@sentry/types/-/types-6.13.2.tgz#8388d5b92ea8608936e7aae842801dc90e0184e6" - integrity sha512-6WjGj/VjjN8LZDtqJH5ikeB1o39rO1gYS6anBxiS3d0sXNBb3Ux0pNNDFoBxQpOhmdDHXYS57MEptX9EV82gmg== +"@sentry/types@6.13.3": + version "6.13.3" + resolved "https://registry.npmjs.org/@sentry/types/-/types-6.13.3.tgz#63ad5b6735b0dfd90b3a256a9f8e77b93f0f66b2" + integrity sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A== -"@sentry/utils@6.13.2": - version "6.13.2" - resolved "https://registry.npmjs.org/@sentry/utils/-/utils-6.13.2.tgz#fb8010e7b67cc8c084d8067d64ef25289269cda5" - integrity sha512-foF4PbxqPMWNbuqdXkdoOmKm3quu3PP7Q7j/0pXkri4DtCuvF/lKY92mbY0V9rHS/phCoj+3/Se5JvM2ymh2/w== +"@sentry/utils@6.13.3": + version "6.13.3" + resolved "https://registry.npmjs.org/@sentry/utils/-/utils-6.13.3.tgz#188754d40afe693c3fcae410f9322531588a9926" + integrity sha512-zYFuFH3MaYtBZTeJ4Yajg7pDf0pM3MWs3+9k5my9Fd+eqNcl7dYQYJbT9gyC0HXK1QI4CAMNNlHNl4YXhF91ag== dependencies: - "@sentry/types" "6.13.2" + "@sentry/types" "6.13.3" tslib "^1.9.3" "@sindresorhus/is@^2.0.0": @@ -2098,10 +2098,10 @@ dependencies: "@types/react" "*" -"@types/react-router-dom@^5.3.0": - version "5.3.0" - resolved "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.3.0.tgz#8c4e0aa0ccaf638ba965829ad29a10ac3cbe2212" - integrity sha512-svUzpEpKDwK8nmfV2vpZNSsiijFNKY8+gUqGqvGGOVrXvX58k1JIJubZa5igkwacbq/0umphO5SsQn/BQsnKpw== +"@types/react-router-dom@^5.3.1": + version "5.3.1" + resolved "https://registry.npmjs.org/@types/react-router-dom/-/react-router-dom-5.3.1.tgz#76700ccce6529413ec723024b71f01fc77a4a980" + integrity sha512-UvyRy73318QI83haXlaMwmklHHzV9hjl3u71MmM6wYNu0hOVk9NLTa0vGukf8zXUqnwz4O06ig876YSPpeK28A== dependencies: "@types/history" "*" "@types/react" "*" @@ -10410,11 +10410,6 @@ react-fast-compare@^3.1.1: resolved "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb" integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA== -react-ga@^3.3.0: - version "3.3.0" - resolved "https://registry.npmjs.org/react-ga/-/react-ga-3.3.0.tgz#c91f407198adcb3b49e2bc5c12b3fe460039b3ca" - integrity sha512-o8RScHj6Lb8cwy3GMrVH6NJvL+y0zpJvKtc0+wmH7Bt23rszJmnqEQxRbyrqUzk9DTJIHoP42bfO5rswC9SWBQ== - react-helmet@^6.0.0: version "6.1.0" resolved "https://registry.npmjs.org/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726"