Commit ca6497db authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Added piwik tracking to redirections as well.

parent e62409ab
......@@ -97,7 +97,13 @@ def redirection(request, short):
except URL.DoesNotExist:
raise Http404("Target URL not found.")
target = url.target
url.clicks = url.clicks + 1
url.save()
return redirect( target )
from piwikapi.tracking import PiwikTracker
from django.conf import settings
piwiktracker = PiwikTracker(settings.PIWIK_SITE_ID, request)
piwiktracker.set_api_url(settings.PIWIK_URL)
piwiktracker.do_track_page_view('Redirect to %s' % url.target)
return redirect( url.target )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment