main.html 740 B

12345678910111213141516171819202122232425262728293031323334
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Document</title>
  6. </head>
  7. <body>
  8. 这是一个空页面
  9. <button id="btn" onclick="handleClick()">点击我</button>
  10. </body>
  11. <!-- Google tag (gtag.js) -->
  12. <script async src="https://www.googletagmanager.com/gtag/js?id=G-8HEB2QHV86"></script>
  13. <script>
  14. window.dataLayer = window.dataLayer || [];
  15. function gtag(){dataLayer.push(arguments);}
  16. gtag('js', new Date());
  17. gtag('config', 'G-8HEB2QHV86');
  18. gtag('event', 'pageview', {
  19. page_path: '/',
  20. value: "js:访问页面"
  21. });
  22. function handleClick() {
  23. gtag('event', 'click', {
  24. event_category: 'test',
  25. event_label: 'click',
  26. value: 'js:点击按钮'
  27. });
  28. }
  29. </script>
  30. </html>