cablelabs / lpwanserver

LPWAN Provisioning & Management Server
https://lpwanserver.com
Apache License 2.0
39 stars 11 forks source link

Add Google Analytics to docs site #341

Closed rhythnic closed 4 years ago

rhythnic commented 4 years ago
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-24446455-9"></script>
    <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'UA-24446455-9');
    </script>
rhythnic commented 4 years ago

Docusaurus has a Google Analytics ID configuration variable. It uses different GA code, but hopefully it accomplishes what we need. I didn't see how to edit the index.html file directly, but if this doesn't suffice, I'll try to figure out how to do that.

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-24446455-9', 'auto');
ga('send', 'pageview');