refactor(analytics): streamline Google Analytics integration and remove proxy routes
- Replaced the previous Google Analytics proxy routes with a direct integration in the layout component for improved performance and simplicity. - Updated the Next.js configuration to include new rewrite rules for Google Analytics scripts and collection endpoints. - Removed outdated proxy logic to enhance code clarity and maintainability.
This commit is contained in:
1 parent
54d99fbffd
commit
525ef140fe
5 files changed
+40
-195
No files matched your search
+8
-4
@@ -79,11 +79,15 @@ const nextConfig: NextConfig = {
|
||||
source: "/analytics/:match*",
|
||||
destination: "https://analytics.evandro.dev.br/:match*",
|
||||
},
|
||||
// Google Analytics - Fallback rewrites (as API routes são preferenciais)
|
||||
// Estes rewrites servem como fallback caso as API routes falhem
|
||||
// Google Analytics - Script principal
|
||||
{
|
||||
source: "/api/gtm/:id",
|
||||
destination: "https://www.googletagmanager.com/gtag/js?id=:id",
|
||||
source: "/metrics/js/script.js",
|
||||
destination: "https://www.googletagmanager.com/gtag/js?id=G-QTT9QT0T3S",
|
||||
},
|
||||
// Google Analytics - Endpoint de coleta
|
||||
{
|
||||
source: "/metrics/collect",
|
||||
destination: "https://www.google-analytics.com/g/collect",
|
||||
},
|
||||
];
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user