From b41ef751fba7829d90d66848519f3abbfe4cb929 Mon Sep 17 00:00:00 2001 From: delivan Date: Sat, 17 Dec 2022 23:45:50 +0900 Subject: [PATCH] Track registration flow --- next.config.js | 27 ++++++++------------------- pages/_app.tsx | 2 +- pages/complete/index.tsx | 5 +++++ pages/index.tsx | 4 ++++ pages/verification/index.tsx | 3 +++ 5 files changed, 21 insertions(+), 20 deletions(-) diff --git a/next.config.js b/next.config.js index b35bd24..43559ad 100644 --- a/next.config.js +++ b/next.config.js @@ -1,8 +1,10 @@ // eslint-disable-next-line @typescript-eslint/no-var-requires const { withSentryConfig } = require("@sentry/nextjs"); -/** @type {import('next').NextConfig} */ const nextConfig = { + sentry: { + hideSourceMaps: true, + }, reactStrictMode: false, swcMinify: true, compiler: { @@ -24,26 +26,13 @@ const nextConfig = { }, ], }, - sentry: { - // Use `hidden-source-map` rather than `source-map` as the Webpack `devtool` - // for client-side builds. (This will be the default starting in - // `@sentry/nextjs` version 8.0.0.) See - // https://webpack.js.org/configuration/devtool/ and - // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map - // for more information. - }, }; const sentryWebpackPluginOptions = { - // Additional config options for the Sentry Webpack plugin. Keep in mind that - // the following options are set automatically, and overriding them is not - // recommended: - // release, url, org, project, authToken, configFile, stripPrefix, - // urlPrefix, include, ignore - - silent: true, // Suppresses all logs - // For all available options, see: - // https://github.com/getsentry/sentry-webpack-plugin#options. + silent: true, }; -module.export = withSentryConfig(nextConfig, sentryWebpackPluginOptions); +module.exports = + process.env.NEXT_IS_ENABLE_USER_TRACKING === "true" + ? withSentryConfig(nextConfig, sentryWebpackPluginOptions) + : nextConfig; diff --git a/pages/_app.tsx b/pages/_app.tsx index 718124c..cf5a197 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -35,7 +35,7 @@ export default function App({ Component, pageProps }: AppProps) { const handleRouteChangeComplete = (url: string) => { const pathname = url.split("?")[0]; - amplitude.track("View page", { + amplitude.track("view page", { pathname, }); }; diff --git a/pages/complete/index.tsx b/pages/complete/index.tsx index e0deb40..a3e8b44 100644 --- a/pages/complete/index.tsx +++ b/pages/complete/index.tsx @@ -1,3 +1,4 @@ +import * as amplitude from "@amplitude/analytics-browser"; import Image from "next/image"; import styled from "styled-components"; @@ -44,6 +45,8 @@ export default function CompletePage() { ); if (!result.code || result.code === 0) { + amplitude.track("complete registration"); + const addresses = await queryAddressesFromTwitterName(twitterUserName); setRegisteredAddressed(addresses.data.addresses); setIsSuccess(true); @@ -54,6 +57,8 @@ export default function CompletePage() { }; const onClickShareButton = () => { + amplitude.track("click share button"); + const { twitterUsername } = router.query; const shareMessage = `👨‍🚀 To Interchain... And Beyond!%0a%0aHey frens, I just minted my name for the interchain on @icns_xyz: ${twitterUsername}%0a%0aClaim yours now ▶`; diff --git a/pages/index.tsx b/pages/index.tsx index 3e03e31..45bce1a 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,3 +1,5 @@ +import * as amplitude from "@amplitude/analytics-browser"; + // NextJs import Image from "next/image"; @@ -24,6 +26,8 @@ export default function Home() { const [isModalOpen, setModalOpen] = useState(false); const onClickConnectWalletButton = async () => { + amplitude.track("click connect wallet button"); + setModalOpen(true); }; diff --git a/pages/verification/index.tsx b/pages/verification/index.tsx index 4dbbc7e..7a164d0 100644 --- a/pages/verification/index.tsx +++ b/pages/verification/index.tsx @@ -1,3 +1,5 @@ +import * as amplitude from "@amplitude/analytics-browser"; + // React import { useEffect, useState } from "react"; @@ -260,6 +262,7 @@ export default function VerificationPage() { }; const onClickRegistration = async () => { + amplitude.track("click register button"); try { const { state, code } = checkTwitterAuthQueryParameter( window.location.search,