google_analytics.html 1.5 KB

1234567891011121314151617181920212223242526
  1. {% if site.google_analytics %}
  2. <!-- Google Analytics -->
  3. {% unless site.gtag %}
  4. <div id="bj-ganalytics-deprecated-msg" style="position: fixed; background: #b90404; bottom: 0; width: 100%; z-index: 10000; color: #f0f0f0; text-align: center; padding: 0.5rem;">
  5. <div title="Close" onclick="$(this).parent().remove()" style="position: absolute; right: 5px; top: 0; font-size: 1.5em; line-height: 1; cursor: pointer;">&times;</div>
  6. <div style="max-width: 800px; margin: auto; font-size: 1.1em;">
  7. This website is using outdated Google Analytics
  8. <details style="font-size: 0.8em;">
  9. <summary>More info</summary>
  10. As of July 2023, Google's Universal Analytics is going away and being replaced by Google Analytics 4. This website is still using the old Universal Analytics. In order to remove this message, the website owner must remove the <code>google_analytics</code> property in the website's config file, and optionally replace it with the new <code>gtag</code> property.
  11. </details>
  12. </div>
  13. </div>
  14. {% endunless %}
  15. <script>
  16. (function (i, s, o, g, r, a, m) {
  17. i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () {
  18. (i[r].q = i[r].q || []).push(arguments)
  19. }, i[r].l = 1 * new Date(); a = s.createElement(o),
  20. m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m)
  21. })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');
  22. ga('create', '{{ site.google_analytics }}', 'auto');
  23. ga('send', 'pageview');
  24. </script>
  25. <!-- End Google Analytics -->
  26. {% endif %}