Skip to content

Remove UA API dependencies #2162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions gatsby/onInitialClientRender.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ export const onInitialClientRender = () => {
// TODO - Remove :analytics and replace it with the discovery document.
window.gapi.load("client:auth2:analytics", () => {
Promise.all([
window.gapi.client.load(
"https://analyticsreporting.googleapis.com/$discovery/rest?version=v4"
),
window.gapi.client.load(
"https://analyticsdata.googleapis.com/$discovery/rest"
),
Expand Down
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
"react-helmet": "^6.1.0",
"react-icons": "^4.8.0",
"react-json-view": "^1.21.3",
"react-markdown": "^9.0.1",
"react-loader-spinner": "^6.1.6",
"react-markdown": "^9.0.1",
"react-redux": "^8.0.5",
"react-syntax-highlighter": "^15.5.0",
"redux": "^4.2.1",
Expand All @@ -61,10 +61,8 @@
"@testing-library/user-event": "^13.1.8",
"@types/gapi": "^0.0.39",
"@types/gapi.auth2": "^0.0.54",
"@types/gapi.client.analytics": "^3.0.7",
"@types/gapi.client.analyticsadmin": "^1.0.0",
"@types/gapi.client.analyticsdata": "^1.0.2",
"@types/gapi.client.analyticsreporting": "^4.0.3",
"@types/gtag.js": "^0.0.5",
"@types/jest": "^26.0.23",
"@types/node": "^18.16.5",
Expand Down
39 changes: 0 additions & 39 deletions src/components/Layout/GA4Toggle.tsx

This file was deleted.

8 changes: 6 additions & 2 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import { GAVersion, Url } from "../../constants"
import Spinner from "../Spinner"
import { linkData } from "./links"
import GA4Toggle from "./GA4Toggle"
import BugReport from "./BugReport"
import Loadable from "../Loadable"
import useLogin2, { UserStatus } from "./useLogin"
Expand Down Expand Up @@ -118,7 +117,7 @@
user,
}) => {
usePageView(title)
const { gaVersion, setGAVersion } = useGAVersion(pathname)

Check warning on line 120 in src/components/Layout/index.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

'setGAVersion' is assigned a value but never used

const [open, setOpen] = React.useState(false)

Expand All @@ -130,7 +129,12 @@
const newLocation = window.location.href.replace( window.location.hostname, newHostname );
window.location.replace(newLocation);
}
//}, 1000);

if( !window.location.search && window.location.pathname === '/' ) {
const newLocation = window.location.pathname = '/ga4/';
window.location.replace(newLocation);
}
//}, 1000);

return;
}, []);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react"
import { styled } from '@mui/material/styles';
import { useTheme } from "@mui/material"
import {Circles} from "react-loader-spinner"
import { Circles } from 'react-loader-spinner'
import {PropsWithChildren} from 'react';

const PREFIX = 'Spinner';
Expand Down
Loading