feat: conditionally inject Cloudflare Analytics script
- Updated index.html to include a placeholder for Cloudflare Web Analytics, which is now only injected in production mode. - Modified vite.config.ts to implement an HTML transform plugin that dynamically adds the Cloudflare script based on the environment.
This commit is contained in:
@@ -65,8 +65,8 @@
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
|
||||
<!-- Cloudflare Web Analytics -->
|
||||
<script defer src='https://static.cloudflareinsights.com/beacon.min.js' data-cf-beacon='{"token": "2aecdc025eb043bc89ce931b54a80054"}'></script>
|
||||
<!-- Cloudflare Web Analytics - Only in Production -->
|
||||
<!--CLOUDFLARE_ANALYTICS_PLACEHOLDER-->
|
||||
<!-- End Cloudflare Web Analytics -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user