reverse0x90 / edCTF

CTF Web Framework Using Ember and Django
Apache License 2.0
8 stars 3 forks source link

edctf: add support for google analytics #19

Open x64x6a opened 8 years ago

x64x6a commented 8 years ago

I don't have experience with Google Analytics, but I believe that you just need an API key to use it.
I don't think we'd need to display anything extra, just add support to load the Google Analytics web pages using an admin's API key. I believe we would just need to add some javascript from google to do this. I think you can just insert something like the following in your website and google will handle the rest:

<script>
  (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', 'XXXXXXXXXXX', 'auto');
  ga('send', 'pageview');

</script>

Reference: https://support.google.com/analytics/answer/1008080?hl=en

Probably can an optional field for creating/editing a CTF? Then we could just put have admins add their API key then. If the API key is in the ctf model, then use that javascript (or similar) and use the API key.

16

@clevernyyyy