Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Simon Daron
panikweb
Commits
f2ce0968
Commit
f2ce0968
authored
Aug 29, 2013
by
fred
Browse files
add support for piwik tracker code (disabled by default)
parent
4457fcaf
Changes
4
Hide whitespace changes
Inline
Side-by-side
panikweb/paniktags/templatetags/paniktags.py
View file @
f2ce0968
...
...
@@ -3,6 +3,7 @@ import urllib2
import
uuid
from
django
import
template
from
django.conf
import
settings
from
django.db.models.query
import
QuerySet
from
django.utils
import
simplejson
from
datetime
import
datetime
,
timedelta
...
...
@@ -166,3 +167,8 @@ class FormatSearchResultNode(template.Node):
}
t
=
template
.
loader
.
get_template
(
'%s/search_result.html'
%
dir_mapping
.
get
(
result
.
model_name
))
return
t
.
render
(
template
.
context
.
Context
({
'result'
:
result
},
autoescape
=
context
.
autoescape
))
@
register
.
inclusion_tag
(
'includes/piwik.html'
)
def
piwik
():
return
{
'enabled'
:
settings
.
ENABLE_PIWIK
}
panikweb/settings.py
View file @
f2ce0968
...
...
@@ -164,6 +164,8 @@ FIBER_TEMPLATE_CHOICES = (
(
'tpl-default.html'
,
'Default template'
),
)
ENABLE_PIWIK
=
False
try
:
from
local_settings
import
*
except
ImportError
,
e
:
...
...
panikweb_templates/templates/base.html
View file @
f2ce0968
...
...
@@ -58,5 +58,7 @@
{% block pageend %}
{% endblock %}
{% piwik %}
</body>
</html>
panikweb_templates/templates/includes/piwik.html
0 → 100644
View file @
f2ce0968
{% if enabled %}
<!-- Piwik -->
<script
type=
"text/javascript"
>
var
_paq
=
_paq
||
[];
_paq
.
push
([
"
trackPageView
"
]);
_paq
.
push
([
"
enableLinkTracking
"
]);
(
function
()
{
var
u
=
((
"
https:
"
==
document
.
location
.
protocol
)
?
"
https
"
:
"
http
"
)
+
"
://stats.radiopanik.org/
"
;
_paq
.
push
([
"
setTrackerUrl
"
,
u
+
"
piwik.php
"
]);
_paq
.
push
([
"
setSiteId
"
,
"
2
"
]);
var
d
=
document
,
g
=
d
.
createElement
(
"
script
"
),
s
=
d
.
getElementsByTagName
(
"
script
"
)[
0
];
g
.
type
=
"
text/javascript
"
;
g
.
defer
=
true
;
g
.
async
=
true
;
g
.
src
=
u
+
"
piwik.js
"
;
s
.
parentNode
.
insertBefore
(
g
,
s
);
})();
</script>
<!-- End Piwik Code -->
{% endif %}
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