Skip to content

Commit

Permalink
Use Google Analyics to track page views. Stop tracking individual val…
Browse files Browse the repository at this point in the history
…idations.
  • Loading branch information
JasonSanford committed Apr 12, 2016
1 parent f4c90ad commit 0b04c20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
9 changes: 9 additions & 0 deletions geojsonlint/templates/index.html
Expand Up @@ -13,6 +13,15 @@
</head>

<body>
<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-7385360-18', 'auto');
ga('send', 'pageview');
</script>
<div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
Expand Down
16 changes: 0 additions & 16 deletions geojsonlint/utils.py
Expand Up @@ -7,22 +7,6 @@
from .schemas import point, multipoint, linestring, multilinestring, polygon, multipolygon, geometrycollection, feature, featurecollection


def track_validate(valid=True):
try:
#
# This is just a nice-to-have. Do not fail tests or bail on the request
# for anything that goes wrong here.
#
value = 1 if valid else 0
tracker = Tracker(account_id='UA-7385360-18', domain_name='geojsonlint.com')
event = Event(category='server', action='validate', value=value)
session = Session()
visitor = Visitor()
tracker.track_event(event, session, visitor)
except:
pass


def validate_geojson(test_geojson):
geojson_types = {
'Point': point,
Expand Down
4 changes: 1 addition & 3 deletions geojsonlint/views.py
Expand Up @@ -4,7 +4,7 @@
from django.views.decorators.http import require_http_methods
from django.shortcuts import render_to_response

from utils import track_validate, validate_geojson, get_remote_json
from utils import validate_geojson, get_remote_json
from exc import GeoJSONValidationException, NonFetchableURLException


Expand Down Expand Up @@ -54,15 +54,13 @@ def validate(request):
return _geojson_error(str(e), testing)

# Everything checked out. Return 'ok'.
track_validate()
resp = {
'status': 'ok',
}
return HttpResponse(json.dumps(resp), mimetype='application/json')


def _geojson_error(message, testing=False, status=200):
track_validate(valid=False)
resp = {
'status': 'error',
'message': message,
Expand Down

0 comments on commit 0b04c20

Please sign in to comment.