use store instead of localStorage to disable GoatCounter
This commit is contained in:
parent
54e4f5e721
commit
b40278f4dc
|
@ -412,10 +412,12 @@ def setup_do_not_track(app):
|
||||||
@app.route("/dnt")
|
@app.route("/dnt")
|
||||||
def do_not_track():
|
def do_not_track():
|
||||||
return """
|
return """
|
||||||
|
<script src="/static/local-storage-polyfill.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// Disable GoatCounter if this script is called
|
// Disable GoatCounter if this script is called
|
||||||
|
|
||||||
window.localStorage.setItem('goatcounter-ignore', 't');
|
store.set('goatcounter-ignore', 't');
|
||||||
|
|
||||||
alert("GoatCounter disabled");
|
alert("GoatCounter disabled");
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,7 @@
|
||||||
{% block script %}
|
{% block script %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
<script src="/static/local-storage-polyfill.js"></script>
|
||||||
<script>
|
<script>
|
||||||
(function () {
|
(function () {
|
||||||
// only enable on prod
|
// only enable on prod
|
||||||
|
@ -182,7 +183,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem('goatcounter-ignore') === 't') {
|
if (store.get('goatcounter-ignore') === 't') {
|
||||||
console.log("GoatCounter is disabled");
|
console.log("GoatCounter is disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue