From a4f794c3ab4034007251fe2cb927a1c94f07a10f Mon Sep 17 00:00:00 2001
From: Jimmy Liow <18777396951@163.com>
Date: Wed, 5 Jul 2023 13:47:48 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20GA4=20=E8=B7=9F=E8=B8=AA?=
=?UTF-8?q?=E8=B7=AF=E7=94=B1=E5=8F=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 7 +++++++
src/views/App.jsx | 9 +++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/index.html b/index.html
index c316114..83cb221 100644
--- a/index.html
+++ b/index.html
@@ -14,6 +14,13 @@
100%{-webkit-transform:translate(150px)}
}
+
+
diff --git a/src/views/App.jsx b/src/views/App.jsx
index 42c25f9..65c1819 100644
--- a/src/views/App.jsx
+++ b/src/views/App.jsx
@@ -1,4 +1,4 @@
-import { Outlet, Link, useHref, useNavigate, NavLink } from "react-router-dom";
+import { Outlet, Link, useHref, useNavigate, useLocation, NavLink } from "react-router-dom";
import { useEffect, useState } from 'react';
import { observer } from "mobx-react";
import { toJS } from "mobx";
@@ -39,13 +39,18 @@ function App() {
const href = useHref();
const loginToken = login.token;
const navigate = useNavigate();
+ const location = useLocation();
+
useEffect(() => {
- // console.info("href: " + href + '; login.token: ' + loginToken + '; timeout: ' + login.timeout);
if (href !== '/login' && isEmpty(loginToken)) {
navigate('/login');
}
}, [href]);
+ useEffect(() => {
+ window.gtag('event', 'page_view', { page_location: window.location.href });
+ }, [location]);
+
const onSubmit = () => {
authStore.valdateUserPassword(login.username, password)
.then(() => {