refactor(analytics): update Google Analytics routes and enhance script handling
- Renamed and updated Google Analytics script and collection endpoints in the Next.js configuration for better clarity and security. - Adjusted the GoogleAnalytics component to reflect new script sources and transport URLs, improving tracking accuracy and data handling. - Removed unnecessary meta tags and preload links in the layout component to streamline the codebase.
This commit is contained in:
1 parent
525ef140fe
commit
a464ecd0fa
3 files changed
+9
-11
No files matched your search
@@ -8,7 +8,7 @@ export default function GoogleAnalytics() {
|
||||
return (
|
||||
<>
|
||||
<Script
|
||||
src="/metrics/js/script.js"
|
||||
src="/sys/libs/vendor-utils.js"
|
||||
strategy="afterInteractive"
|
||||
/>
|
||||
<Script id="google-analytics" strategy="afterInteractive">
|
||||
@@ -18,10 +18,12 @@ export default function GoogleAnalytics() {
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '${GA_MEASUREMENT_ID}', {
|
||||
transport_url: '/metrics/collect',
|
||||
transport_url: window.location.origin + '/sys/api/vitals',
|
||||
cookie_flags: 'SameSite=None;Secure',
|
||||
allow_ad_personalization_signals: false,
|
||||
anonymize_ip: true
|
||||
anonymize_ip: true,
|
||||
page_location: window.location.href,
|
||||
page_title: document.title
|
||||
});
|
||||
`}
|
||||
</Script>
|
||||
|
||||
@@ -166,15 +166,11 @@ export default function RootLayout({ children }: Readonly<RootLayoutProps>) {
|
||||
|
||||
{/* Theme color for mobile browsers */}
|
||||
<meta name="msapplication-TileColor" content="#000000" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta
|
||||
name="apple-mobile-web-app-status-bar-style"
|
||||
content="black-translucent"
|
||||
/>
|
||||
<meta name="apple-mobile-web-app-title" content="Evandro.dev" />
|
||||
|
||||
{/* Performance hints */}
|
||||
<link rel="preload" href="/edev.jpeg" as="image" />
|
||||
</head>
|
||||
<body
|
||||
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
|
||||
|
||||
+4
-4
@@ -79,14 +79,14 @@ const nextConfig: NextConfig = {
|
||||
source: "/analytics/:match*",
|
||||
destination: "https://analytics.evandro.dev.br/:match*",
|
||||
},
|
||||
// Google Analytics - Script principal
|
||||
// Google Analytics - Script principal (camuflado como lib de sistema)
|
||||
{
|
||||
source: "/metrics/js/script.js",
|
||||
source: "/sys/libs/vendor-utils.js",
|
||||
destination: "https://www.googletagmanager.com/gtag/js?id=G-QTT9QT0T3S",
|
||||
},
|
||||
// Google Analytics - Endpoint de coleta
|
||||
// Google Analytics - Endpoint de coleta (camuflado como API de vitals)
|
||||
{
|
||||
source: "/metrics/collect",
|
||||
source: "/sys/api/vitals",
|
||||
destination: "https://www.google-analytics.com/g/collect",
|
||||
},
|
||||
];
|
||||
|
||||
Reference in new issue
Block a user