makeabilitylab / makeabilitylabwebsite

The Makeability Lab website
https://makeabilitylab.cs.washington.edu
MIT License
9 stars 64 forks source link

Need to add in Google Analytics #54

Closed jonfroehlich closed 8 years ago

jonfroehlich commented 8 years ago

Need to add in Google Analytics and statcounter to webpage. I'll look into doing this.

jonfroehlich commented 8 years ago

I registered makeabilitylab.umiacs.umd.edu with Google Analytics. Our Tracking ID is 'UA-79723676-1.' Here's the auto-generated javascript:

<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', 'UA-79723676-1', 'auto');
  ga('send', 'pageview');
</script>

We want to track all pages. Not sure what the best way is to do this in Django, maybe put it in the base template? @Jamjarman, can you read about this and implement the best approach. Here are some relevant links:

@lstearns86, do you have any experience with this?

Thanks!

Update: just fixed script so that it displays properly in the github textfield.

lstearns86 commented 8 years ago

I've used Google Analytics on my own site and on our recruitment ads, but those are just single pages. I think that we probably want to put it into its own module that is imported into the base template, for maximum coverage and flexibility. Then we'll also want to tie it into any media urls requested through Django to enable tracking of direct pdf downloads as well.

On Wed, Jun 22, 2016 at 12:15 PM Jon Froehlich notifications@github.com wrote:

I registered makeabilitylab.umiacs.umd.edu with Google Analytics. Our Tracking ID is 'UA-79723676-1.' Here's the auto-generated javascript:

We want to track all pages. Not sure what the best way is to do this in Django, maybe put it in the base template? @Jamjarman https://github.com/Jamjarman, can you read about this and implement the best approach. Here are some relevant links:

- http://stackoverflow.com/questions/629696/deploying-google-analytics-with-django

http://www.nomadblue.com/blog/django/google-analytics-tracking-code-into-django-project/

@lstearns86 https://github.com/lstearns86, do you have any experience with this?

Thanks!

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/jonfroehlich/makeabilitylabwebsite/issues/54#issuecomment-227796046, or mute the thread https://github.com/notifications/unsubscribe/ACNkgtmjnAAUxG_89FPFLA9yD2aOH6cAks5qOV-3gaJpZM4IyOp0 .

mattm401 commented 8 years ago

Frequently I've just added them into the footer template (assuming that's on every page).

Jamjarman commented 8 years ago

It seems like we could include it in base tied to production/development environment. I will add this in when I set up the production/development environment differences for the databases. That way it can be tied to where it's deployed and we won't have to worry at all about whether or not we are changing settings manually just like the databases will be.

jonfroehlich commented 8 years ago

Sounds good. Please propose an approach before implementing it.

I think it's going to require something more sophisticated than Matt's suggestion if we are going to track everything through Google Analytics.

Jon

On Thu, Jun 23, 2016 at 1:46 PM, James Gilkeson notifications@github.com wrote:

It seems like we could include it in base tied to production/development environment. I will add this in when I set up the production/development environment differences for the databases. That way it can be tied to where it's deployed and we won't have to worry at all about whether or not we are changing settings manually just like the databases will be.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/jonfroehlich/makeabilitylabwebsite/issues/54#issuecomment-228127040, or mute the thread https://github.com/notifications/unsubscribe/ABi-9XxlcoTIN8ec-QJohg5NanJH-r9Wks5qOsZZgaJpZM4IyOp0 .

Jon Froehlich Assistant Professor Computer Science University of Maryland, College Park http://www.cs.umd.edu/~jonf/ @jonfroehlich https://twitter.com/jonfroehlich - Twitter

Jamjarman commented 8 years ago

Once we merge in Derek's changes we will have a an environment where debug is set in development but not in production. I propose that we use this to insert a template containing our google analytics when debug is turned off (in production).

This is similar to this solution. We can use the config file to inject the parts specific to us just like in this solution as well.

We could also use this solution to track link clicks to PDF's like you do on your website Jon by inserting the javascript on links whenever we aren't in debug mode. This doesn't solve the direct links to PDF's from things like google scholar but I don't think we can get google analytics to track those, it will probably have to be done through Django and the data combined in our dashboard.

Jamjarman commented 8 years ago

Added google analytics in branch #79