1
0
mirror of https://github.com/uetchy/namae.git synced 2025-03-16 20:20:38 +09:00

chore: omit ga

This commit is contained in:
uetchy 2021-10-07 19:03:51 +09:00
parent 248359bb09
commit ad58f4f567
7 changed files with 101 additions and 124 deletions

View File

@ -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",

View File

@ -54,6 +54,12 @@
href="https://fonts.googleapis.com/css?family=Montserrat:600&display=swap"
rel="stylesheet"
/>
<script
async
defer
data-website-id="a0bfb495-787b-4960-938d-c4a190aa7455"
src="https://analytics.uechi.io/umami.js"
></script>
<title>namae</title>
</head>
<body>

View File

@ -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 = () => {
<Title>{t('community')}</Title>
<ul>
<li>
<OutboundLink
to="https://github.com/uetchy/namae"
eventLabel="GitHub Repo"
<a
href="https://github.com/uetchy/namae"
aria-label="Go to GitHub repository"
target="_blank"
rel="noreferrer"
>
GitHub
</OutboundLink>
</a>
</li>
<li>
<OutboundLink
to="https://github.com/uetchy/namae/issues"
eventLabel="GitHub Issues"
<a
href="https://github.com/uetchy/namae/issues"
aria-label="Go to GitHub Issues"
target="_blank"
rel="noreferrer"
>
{t('issues')}
</OutboundLink>
</a>
</li>
<li>
<OutboundLink
to="https://dev.to/uetchy/give-your-app-slick-name-with-namae-dev-5c4h"
eventLabel="Blog article"
<a
href="https://dev.to/uetchy/give-your-app-slick-name-with-namae-dev-5c4h"
aria-label="Go to blog"
target="_blank"
rel="noreferrer"
>
{t('blog')}
</OutboundLink>
</a>
</li>
</ul>
<Box>
@ -110,54 +109,54 @@ const About = () => {
</span>{' '}
by{' '}
<OutboundLink
to="https://twitter.com/uechz"
eventLabel="Author Page"
<a
href="https://twitter.com/uechz"
aria-label="Author page"
target="_blank"
rel="noreferrer"
>
<Bold>Yasuaki Uechi</Bold>
</OutboundLink>
</a>
</p>
<ShareBox>
<Links>
<OutboundLink
to={`https://twitter.com/intent/tweet?text=${encodeURIComponent(
<a
href={`https://twitter.com/intent/tweet?text=${encodeURIComponent(
`namae — ${t('title')}`
)}&url=${encodeURIComponent('https://namae.dev')}`}
eventLabel="Tweet"
aria-label="Tweet this page"
target="_blank"
rel="noreferrer"
>
<FaTwitter />
</OutboundLink>
<OutboundLink
to="https://www.producthunt.com/posts/namae"
eventLabel="ProductHunt"
</a>
<a
href="https://www.producthunt.com/posts/namae"
aria-label="Go to ProductHunt page"
target="_blank"
rel="noreferrer"
>
<FaProductHunt />
</OutboundLink>
<OutboundLink
to="https://github.com/uetchy/namae"
eventLabel="GitHub Repo"
</a>
<a
href="https://github.com/uetchy/namae"
aria-label="Go to GitHub repository"
target="_blank"
rel="noreferrer"
>
<FaGithub />
</OutboundLink>
<OutboundLink
to="https://github.com/sponsors/uetchy"
eventLabel="GitHub Sponsors"
</a>
<a
href="https://github.com/sponsors/uetchy"
aria-label="Go to GitHub Sponsors"
target="_blank"
rel="noreferrer"
>
<SponsorBadge>
<GoHeart size="1.3em" />
<span>Sponsor</span>
</SponsorBadge>
</OutboundLink>
</a>
</Links>
</ShareBox>

View File

@ -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<{
<ResultIcon>{icon}</ResultIcon>
<ResultName>
{link ? (
<OutboundLink
to={link}
eventLabel={link.split('/')[2]}
target="_blank"
>
<a href={link} target="_blank" rel="noreferrer">
{content}
</OutboundLink>
</a>
) : (
content
)}

View File

@ -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(
<StoreProvider store={store}>

View File

@ -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 {

View File

@ -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"