From 4ddd02a66bead960ca41d64a3df78fdfb8cf7bdc Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Fri, 25 Jun 2021 17:56:57 +0400 Subject: [PATCH] add ga --- package.json | 1 + src/App.js | 8 ++++++++ src/content/verbs/verbs-intro.mdx | 2 +- yarn.lock | 5 +++++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 59b953c..aac2183 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "react": "^17.0.1", "react-bootstrap": "^1.5.2", "react-dom": "^17.0.1", + "react-ga": "^3.3.0", "react-router-dom": "^5.2.0", "react-router-hash-link": "^2.3.1", "react-scripts": "3.4.3", diff --git a/src/App.js b/src/App.js index 3a3b020..a549ccd 100644 --- a/src/App.js +++ b/src/App.js @@ -17,12 +17,20 @@ import Sidebar from "./components/Sidebar"; import Header from "./components/Header"; import TableOfContentsPage from "./pages/TableOfContentsPage"; import { useEffect } from "react"; +import ReactGA from "react-ga"; const chapters = content.reduce((chapters, item) => ( item.content ? [...chapters, item] : [...chapters, ...item.chapters] ), []); +const prod = document.location.hostname === "grammar.lingdocs.com"; + +if (prod) { + ReactGA.initialize("UA-196576671-2"); + ReactGA.set({ anonymizeIp: true }); +} + function App(props) { const [navOpen, setNavOpen] = useState(false); useEffect(() => { diff --git a/src/content/verbs/verbs-intro.mdx b/src/content/verbs/verbs-intro.mdx index 65e4e02..4fdcfc2 100644 --- a/src/content/verbs/verbs-intro.mdx +++ b/src/content/verbs/verbs-intro.mdx @@ -22,7 +22,7 @@ These **different verb forms are like tools πŸ”¨πŸ”§βœ‚ that you can use in diff 1. What they are (how to make the verb forms) 2. When to use them (what they mean and what situations they're used in) -If we don't think carefully about this, πŸ€” we will often just assume that we can use the new tools (verb forms) just like we did in our native language. As adults, there is a massive temptation to shove the new verb forms into the categories that we have in our own language, and to try to use the tools like we did before. We can think we know the tool, but because it's actually different we end up using it wrongly by accident and sometimes even cause damage! +If we don't think carefully about this, πŸ€” we will often just assume that we can use the new tools (verb forms) just like we did in our native language. As adults, there is a massive temptation to shove the new verb forms into the categories that we have in our own language, and to try to use the tools like we did before. We can think we know the tool, but because it's actually different we end up using it wrongly and sometimes even cause damage! For example, you may have met a German who's learned excellent English, but when the doorbell rings they jump up and say, _"I get the door!"_ πŸ””πŸšͺπŸƒβ€β™‚οΈ. In English you have to use a different verb form and say, "I'll get the door." But they're so used to using their trusty German tool (the PrΓ€sens) for everything that saying "I get the door" still "feels right" to them, even though it's completely wrong. Taking careful stock of a new set of tools (verb forms) in a language can keep us from mistakes like this. πŸ§°πŸ€“πŸ‘ diff --git a/yarn.lock b/yarn.lock index cb84a14..70285de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9695,6 +9695,11 @@ react-error-overlay@^6.0.7: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.7.tgz#1dcfb459ab671d53f660a991513cb2f0a0553108" integrity sha512-TAv1KJFh3RhqxNvhzxj6LeT5NWklP6rDr2a0jaTfsZ5wSZWHOGeqQyejUp3xxLfPt2UpyJEcVQB/zyPcmonNFA== +react-ga@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.3.0.tgz#c91f407198adcb3b49e2bc5c12b3fe460039b3ca" + integrity sha512-o8RScHj6Lb8cwy3GMrVH6NJvL+y0zpJvKtc0+wmH7Bt23rszJmnqEQxRbyrqUzk9DTJIHoP42bfO5rswC9SWBQ== + react-is@^16.12.0, react-is@^16.3.2, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"