mirror of
https://github.com/jazzband/django-analytical.git
synced 2026-03-16 22:20:25 +00:00
Remove obsolete type attribute in script tags
This commit is contained in:
parent
d3ddf1ac6a
commit
4540999dc1
23 changed files with 33 additions and 34 deletions
|
|
@ -3,6 +3,7 @@ Unreleased
|
|||
* Remove deprecated Piwik integration. Use Matomo instead! (Peter Bittner)
|
||||
* Migrate packaging from setup.py to pyproject.toml with Ruff for linting
|
||||
and formatting (Peter Bittner)
|
||||
* Remove obsolete type attribute in script tags for JavaScript (Peter Bittner)
|
||||
|
||||
Version 3.1.0
|
||||
-------------
|
||||
|
|
|
|||
|
|
@ -12,11 +12,9 @@ from django.template import Library, Node, TemplateSyntaxError
|
|||
from analytical.utils import disable_html, get_required_setting, is_internal_ip
|
||||
|
||||
USER_ID_RE = re.compile(r'^\d+$')
|
||||
INIT_CODE = (
|
||||
"""<script type="text/javascript">var _sf_startpt=(new Date()).getTime()</script>"""
|
||||
)
|
||||
INIT_CODE = """<script>var _sf_startpt=(new Date()).getTime()</script>"""
|
||||
SETUP_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _sf_async_config=%(config)s;
|
||||
(function(){
|
||||
function loadChartbeat() {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from analytical.utils import disable_html, get_required_setting, is_internal_ip
|
|||
|
||||
CLICKMAP_TRACKER_ID_RE = re.compile(r'^\w+$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var clickmapConfig = {tracker: '%(tracker_id)s', version:'2'};
|
||||
window.clickmapAsyncInit = function(){ __clickmap.init(clickmapConfig); };
|
||||
(function() { var _cmf = document.createElement('script'); _cmf.async = true;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from analytical.utils import (
|
|||
|
||||
SITE_ID_RE = re.compile(r'^\d+$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var clicky = { log: function(){ return; }, goal: function(){ return; }};
|
||||
var clicky_site_ids = clicky_site_ids || [];
|
||||
clicky_site_ids.push(%(site_id)s);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from django.template import Library, Node, TemplateSyntaxError
|
|||
from analytical.utils import disable_html, get_required_setting, is_internal_ip
|
||||
|
||||
ACCOUNT_NUMBER_RE = re.compile(r'^\d+$')
|
||||
SETUP_CODE = '<script type="text/javascript" src="{placeholder_url}"></script>'.format(
|
||||
SETUP_CODE = '<script src="{placeholder_url}"></script>'.format(
|
||||
placeholder_url='//dnn506yrbagrg.cloudfront.net/pages/scripts/'
|
||||
'%(account_nr_1)s/%(account_nr_2)s.js'
|
||||
)
|
||||
|
|
@ -58,7 +58,7 @@ class CrazyEggNode(Node):
|
|||
}
|
||||
for (varnr, value) in params
|
||||
)
|
||||
html = '%s\n<script type="text/javascript">%s</script>' % (html, js)
|
||||
html = '%s\n<script>%s</script>' % (html, js)
|
||||
if is_internal_ip(context, 'CRAZY_EGG'):
|
||||
html = disable_html(html, 'Crazy Egg')
|
||||
return html
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from analytical.utils import disable_html, get_required_setting, is_internal_ip
|
|||
|
||||
SITE_ID_RE = re.compile(r'[\da-f]+$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _gauges = _gauges || [];
|
||||
(function() {
|
||||
var t = document.createElement('script');
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ SCOPE_PAGE = 3
|
|||
|
||||
PROPERTY_ID_RE = re.compile(r'^UA-\d+-\d+$')
|
||||
SETUP_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '%(property_id)s']);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ from analytical.utils import (
|
|||
|
||||
TOKEN_RE = re.compile(r'^\S+-\S+-\S+$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var GoSquared={};
|
||||
%(config)s
|
||||
(function(w){
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ from analytical.utils import disable_html, get_required_setting, is_internal_ip
|
|||
|
||||
HEAP_TRACKER_ID_RE = re.compile(r'^\d+$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-"+e+".js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a);for(var n=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],o=0;o<p.length;o++)heap[p[o]]=n(p[o])};
|
||||
<script>
|
||||
window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-"+e+".js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a);for(var n=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],o=0;o<p.length;o++)heap[p[o]]=n(p[o])};
|
||||
heap.load("%(tracker_id)s");
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from analytical.utils import disable_html, get_required_setting, is_internal_ip
|
|||
PORTAL_ID_RE = re.compile(r'^\d+$')
|
||||
TRACKING_CODE = """
|
||||
<!-- Start of Async HubSpot Analytics Code -->
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
(function(d,s,i,r) {
|
||||
if (d.getElementById(i)){return;}
|
||||
var n=d.createElement(s),e=d.getElementsByTagName(s)[0];
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ from analytical.utils import get_identity, get_required_setting
|
|||
ACCOUNT_NUMBER_RE = re.compile(r'^\d+$')
|
||||
SITE_CODE_RE = re.compile(r'^[\w]+$')
|
||||
SETUP_CODE = """
|
||||
<script type="text/javascript">var _kiq = _kiq || []; %(commands)s</script>
|
||||
<script type="text/javascript" src="//s3.amazonaws.com/ki.js/%(account_number)s/%(site_code)s.js" async="true"></script>
|
||||
<script>var _kiq = _kiq || []; %(commands)s</script>
|
||||
<script src="//s3.amazonaws.com/ki.js/%(account_number)s/%(site_code)s.js" async="true"></script>
|
||||
""" # noqa
|
||||
IDENTIFY_CODE = "_kiq.push(['identify', '%s']);"
|
||||
SHOW_SURVEY_CODE = "_kiq.push(['showSurvey', %s]);"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from analytical.utils import (
|
|||
|
||||
API_KEY_RE = re.compile(r'^[0-9a-f]{40}$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _kmq = _kmq || [];
|
||||
%(commands)s
|
||||
function _kms(u){
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ DOMAINPATH_RE = re.compile(r'^(([^./?#@:]+\.)*[^./?#@:]+)+(:[0-9]+)?(/[^/?#@:]+)
|
|||
SITEID_RE = re.compile(r'^\d+$')
|
||||
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _paq = window._paq || [];
|
||||
%(variables)s
|
||||
%(commands)s
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ from analytical.utils import (
|
|||
|
||||
MIXPANEL_API_TOKEN_RE = re.compile(r'^[0-9a-f]{32}$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==
|
||||
<script>(function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!==
|
||||
typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a,
|
||||
e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
|
||||
mixpanel.init('%(token)s');
|
||||
|
|
|
|||
|
|
@ -16,17 +16,17 @@ from analytical.utils import (
|
|||
|
||||
API_KEY_RE = re.compile(r'^\w+$')
|
||||
SETUP_CODE = """
|
||||
<script src="//d1nu2rn22elx8m.cloudfront.net/performable/pax/%(api_key)s.js" type="text/javascript"></script>
|
||||
<script src="//d1nu2rn22elx8m.cloudfront.net/performable/pax/%(api_key)s.js"></script>
|
||||
""" # noqa
|
||||
IDENTIFY_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _paq = _paq || [];
|
||||
_paq.push(["identify", {identity: "%s"}]);
|
||||
</script>
|
||||
"""
|
||||
EMBED_CODE = """
|
||||
<script type="text/javascript" src="//d1nu2rn22elx8m.cloudfront.net/performable/embed/page.js"></script>
|
||||
<script type="text/javascript">
|
||||
<script src="//d1nu2rn22elx8m.cloudfront.net/performable/embed/page.js"></script>
|
||||
<script>
|
||||
(function() {
|
||||
var $f = new PerformableEmbed();
|
||||
$f.initialize({'host': '%(hostname)s', 'page': '%(page_id)s'});
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from analytical.utils import disable_html, get_required_setting, is_internal_ip
|
|||
|
||||
COUNTER_ID_RE = re.compile(r'^\d{7}$')
|
||||
COUNTER_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _tmr = window._tmr || (window._tmr = []);
|
||||
_tmr.push({id: "%(counter_id)s", type: "pageView", start: (new Date()).getTime()});
|
||||
(function (d, w, id) {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ WIDGET_ID_RE = re.compile(
|
|||
r'^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$'
|
||||
)
|
||||
SETUP_CODE = """
|
||||
<script type="text/javascript">
|
||||
document.write(unescape("%%3Cscript src='" + ((document.location.protocol=="https:")?"https://snapabug.appspot.com":"http://www.snapengage.com") + "/snapabug.js' type='text/javascript'%%3E%%3C/script%%3E"));</script><script type="text/javascript">
|
||||
<script>
|
||||
document.write(unescape("%%3Cscript src='" + ((document.location.protocol=="https:")?"https://snapabug.appspot.com":"http://www.snapengage.com") + "/snapabug.js' type='text/javascript'%%3E%%3C/script%%3E"));</script><script>
|
||||
%(settings_code)s
|
||||
</script>
|
||||
""" # noqa
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from analytical.utils import get_identity, get_required_setting
|
|||
|
||||
WIDGET_KEY_RE = re.compile(r'^[a-zA-Z0-9]*$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
|
||||
UserVoice=window.UserVoice||[];(function(){
|
||||
var uv=document.createElement('script');uv.type='text/javascript';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ from analytical.utils import (
|
|||
|
||||
DOMAIN_RE = re.compile(r'^\S+$')
|
||||
TRACKING_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var woo_settings = %(settings)s;
|
||||
var woo_visitor = %(visitor)s;
|
||||
!function(){var a,b,c,d=window,e=document,f=arguments,g="script",h=["config","track","trackForm","trackClick","identify","visit","push","call"],i=function(){var a,b=this,c=function(a){b[a]=function(){return b._e.push([a].concat(Array.prototype.slice.call(arguments,0))),b}};for(b._e=[],a=0;a<h.length;a++)c(h[a])};for(d.__woo=d.__woo||{},a=0;a<f.length;a++)d.__woo[f[a]]=d[f[a]]=d[f[a]]||new i;b=e.createElement(g),b.async=1,b.src="//static.woopra.com/js/w.js",c=e.getElementsByTagName(g)[0],c.parentNode.insertBefore(b,c)}("woopra");
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from analytical.utils import disable_html, get_required_setting, is_internal_ip
|
|||
|
||||
COUNTER_ID_RE = re.compile(r'^\d{8}$')
|
||||
COUNTER_CODE = """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
(function (d, w, c) {
|
||||
(w[c] = w[c] || []).push(function() {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ site id by clicking the *Tracking Code* link when logged into
|
|||
the on the gaug.es website. A page will display containing
|
||||
HTML code looking like this::
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _gauges = _gauges || [];
|
||||
(function() {
|
||||
var t = document.createElement('script');
|
||||
|
|
@ -88,6 +88,6 @@ Internal IP addresses
|
|||
Usually you do not want to track clicks from your development or
|
||||
internal IP addresses. By default, if the tags detect that the client
|
||||
comes from any address in the :const:`ANALYTICAL_INTERNAL_IPS` setting
|
||||
(which is :const:`INTERNAL_IPS` by default,) the tracking code is
|
||||
(which is :const:`INTERNAL_IPS` by default,) the tracking code is
|
||||
commented out. See :ref:`identifying-visitors` for important information
|
||||
about detecting the visitor IP address.
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ find the Javascript embed code of the widget. The widget key is the
|
|||
alphanumerical string contained in the URL of the script imported by the
|
||||
embed code::
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
|
||||
UserVoice=window.UserVoice||[];(function(){
|
||||
var uv=document.createElement('script');uv.type='text/javascript';
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class GaugesTagTestCase(TagTestCase):
|
|||
assert (
|
||||
self.render_tag('gauges', 'gauges')
|
||||
== """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _gauges = _gauges || [];
|
||||
(function() {
|
||||
var t = document.createElement('script');
|
||||
|
|
@ -42,7 +42,7 @@ class GaugesTagTestCase(TagTestCase):
|
|||
assert (
|
||||
GaugesNode().render(Context())
|
||||
== """
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
var _gauges = _gauges || [];
|
||||
(function() {
|
||||
var t = document.createElement('script');
|
||||
|
|
|
|||
Loading…
Reference in a new issue