Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
ca6497db
Commit
ca6497db
authored
Dec 21, 2013
by
Jean Michel Rouly
Browse files
Added piwik tracking to redirections as well.
parent
e62409ab
Changes
1
Show whitespace changes
Inline
Side-by-side
go/go/views.py
View file @
ca6497db
...
...
@@ -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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment