Skip to content

Why not to paste GA4 code directly into HTML? #92

@vporton

Description

@vporton

You didn't explain in your README file, why you recommend to use react-ga4, not just paste it into index.html of the React app. Your README file should contain such an explanation.

<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Google tag (gtag.js) -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-PDPFZKZ3R6"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-PDPFZKZ3R6');
    </script>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Zon Social Network</title>
    <!--base href="/" /-->
    <link rel="icon" href="/favicon.ico" />
    <link type="text/css" rel="stylesheet" href="/main.css" />
  </head>
  <body>
    <div id="app"></div>
    <!-- Ybug code start (https://ybug.io) -->
  <script type='text/javascript'>
    (function() {
        window.ybug_settings = {"id":"r47mfh83w8m5091bscbk"};
        var ybug = document.createElement('script'); ybug.type = 'text/javascript'; ybug.async = true;
        ybug.src = 'https://widget.ybug.io/button/'+window.ybug_settings.id+'.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ybug, s);
    })();
  </script>
  <!-- Ybug code end -->
  </body>
</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions