Skip to content

Commit 5120590

Browse files
authored
ref: remove google analytics (pterodactyl#3912)
1 parent 0ff60d8 commit 5120590

File tree

9 files changed

+33
-38
lines changed

9 files changed

+33
-38
lines changed

app/Http/Requests/Admin/Settings/BaseSettingsFormRequest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ public function rules()
1919
'app:name' => 'required|string|max:191',
2020
'pterodactyl:auth:2fa_required' => 'required|integer|in:0,1,2',
2121
'app:locale' => ['required', 'string', Rule::in(array_keys($this->getAvailableLanguages()))],
22-
'app:analytics' => 'nullable|string',
2322
];
2423
}
2524

@@ -32,7 +31,6 @@ public function attributes()
3231
'app:name' => 'Company Name',
3332
'pterodactyl:auth:2fa_required' => 'Require 2-Factor Authentication',
3433
'app:locale' => 'Default Language',
35-
'app:analytics' => 'Google Analytics',
3634
];
3735
}
3836
}

app/Http/ViewComposers/AssetComposer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function compose(View $view)
3333
'enabled' => config('recaptcha.enabled', false),
3434
'siteKey' => config('recaptcha.website_key') ?? '',
3535
],
36-
'analytics' => config('app.analytics') ?? '',
3736
]);
3837
}
3938
}

app/Providers/SettingsServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class SettingsServiceProvider extends ServiceProvider
2121
protected $keys = [
2222
'app:name',
2323
'app:locale',
24-
'app:analytics',
2524
'recaptcha:enabled',
2625
'recaptcha:secret_key',
2726
'recaptcha:website_key',
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\DB;
4+
use Illuminate\Database\Migrations\Migration;
5+
6+
class DropGoogleAnalytics extends Migration
7+
{
8+
/**
9+
* Run the migrations.
10+
*
11+
* @return void
12+
*/
13+
public function up()
14+
{
15+
DB::table('settings')->where('key', 'settings::app:analytics')->delete();
16+
}
17+
18+
/**
19+
* Reverse the migrations.
20+
*
21+
* @return void
22+
*/
23+
public function down()
24+
{
25+
DB::table('settings')->insert(
26+
[
27+
'key' => 'settings::app:analytics',
28+
]
29+
);
30+
}
31+
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"react-copy-to-clipboard": "^5.0.2",
2525
"react-dom": "npm:@hot-loader/react-dom",
2626
"react-fast-compare": "^3.2.0",
27-
"react-ga": "^3.1.2",
2827
"react-google-recaptcha": "^2.0.1",
2928
"react-hot-loader": "^4.12.21",
3029
"react-i18next": "^11.2.1",

resources/scripts/components/App.tsx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React, { useEffect } from 'react';
2-
import ReactGA from 'react-ga';
1+
import React from 'react';
32
import { hot } from 'react-hot-loader/root';
4-
import { Route, Router, Switch, useLocation } from 'react-router-dom';
3+
import { Route, Router, Switch } from 'react-router-dom';
54
import { StoreProvider } from 'easy-peasy';
65
import { store } from '@/state';
76
import DashboardRouter from '@/routers/DashboardRouter';
@@ -33,16 +32,6 @@ interface ExtendedWindow extends Window {
3332

3433
setupInterceptors(history);
3534

36-
const Pageview = () => {
37-
const { pathname } = useLocation();
38-
39-
useEffect(() => {
40-
ReactGA.pageview(pathname);
41-
}, [ pathname ]);
42-
43-
return null;
44-
};
45-
4635
const App = () => {
4736
const { PterodactylUser, SiteConfiguration } = (window as ExtendedWindow);
4837
if (PterodactylUser && !store.getState().user.data) {
@@ -62,12 +51,6 @@ const App = () => {
6251
store.getActions().settings.setSettings(SiteConfiguration!);
6352
}
6453

65-
useEffect(() => {
66-
if (SiteConfiguration?.analytics) {
67-
ReactGA.initialize(SiteConfiguration!.analytics);
68-
}
69-
}, []);
70-
7154
return (
7255
<>
7356
<GlobalStylesheet/>
@@ -76,7 +59,6 @@ const App = () => {
7659
<ProgressBar/>
7760
<div css={tw`mx-auto w-auto`}>
7861
<Router history={history}>
79-
{SiteConfiguration?.analytics && <Pageview/>}
8062
<Switch>
8163
<Route path="/server/:id" component={ServerRouter}/>
8264
<Route path="/auth" component={AuthenticationRouter}/>

resources/scripts/state/settings.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export interface SiteSettings {
77
enabled: boolean;
88
siteKey: string;
99
};
10-
analytics: string;
1110
}
1211

1312
export interface SettingsStore {

resources/views/admin/settings/index.blade.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,6 @@
3131
<p class="text-muted"><small>This is the name that is used throughout the panel and in emails sent to clients.</small></p>
3232
</div>
3333
</div>
34-
<div class="form-group col-md-4">
35-
<label class="control-label">Google Analytics</label>
36-
<div>
37-
<input type="text" class="form-control" name="app:analytics" value="{{ old('app:analytics', config('app.analytics')) }}" />
38-
<p class="text-muted"><small>This is your Google Analytics Tracking ID, Ex. UA-123723645-2</small></p>
39-
</div>
40-
</div>
4134
<div class="form-group col-md-4">
4235
<label class="control-label">Require 2-Factor Authentication</label>
4336
<div>

yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6221,11 +6221,6 @@ react-fast-compare@^3.2.0:
62216221
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
62226222
integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
62236223

6224-
react-ga@^3.1.2:
6225-
version "3.1.2"
6226-
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.1.2.tgz#e13f211c51a2e5c401ea69cf094b9501fe3c51ce"
6227-
integrity sha512-OJrMqaHEHbodm+XsnjA6ISBEHTwvpFrxco65mctzl/v3CASMSLSyUkFqz9yYrPDKGBUfNQzKCjuMJwctjlWBbw==
6228-
62296224
react-google-recaptcha@^2.0.1:
62306225
version "2.0.1"
62316226
resolved "https://registry.yarnpkg.com/react-google-recaptcha/-/react-google-recaptcha-2.0.1.tgz#3276b29659493f7ca2a5b7739f6c239293cdf1d8"

0 commit comments

Comments
 (0)