Skip to content

Commit

Permalink
Don't render analytics with mkdocs serve
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbenito committed Mar 31, 2024
1 parent 301a5e5 commit 773637d
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions docs/overrides/partials/integrations/analytics/simpleanalytics.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<!-- Simple Analytics - 100% privacy-first analytics -->
<script async defer
src="https://{{ config.extra.analytics.script_domain | default('scripts.simpleanalyticscdn.com')}}/latest.js"
data-collect-dnt="true"
data-hostname="{{ config.extra.analytics.hostname }}"></script>
<noscript>
<img src="https://{{ config.extra.analytics.noscript_domain | default('queue.simpleanalyticscdn.com' )}}/noscript.gif?collect-dnt={{ config.extra.analytics.collect_dnt }}&hostname={{ config.extra.analytics.hostname }}&path={{ page.url }}"
alt=""
referrerpolicy="no-referrer-when-downgrade">
</noscript>
{% set site_domain = config.site_url | replace('https://', '') | replace('http://', '') | trim('/') %}
{% set dev_domain = config.dev_addr | replace('https://', '') | replace('http://', '') | trim('/') %}
{% set develop = site_domain.startswith(dev_domain) %}
{% if not develop %}
{% set hostname = config.extra.analytics.hostname | default(site_domain) %}
{% set script_domain = config.extra.analytics.script_domain | default('scripts.simpleanalyticscdn.com') %}
{% set noscript_domain = config.extra.analytics.noscript_domain | default('queue.simpleanalyticscdn.com') %}
{% set collect_dnt = config.extra.analytics.collect_dnt | default('false') %}
<script async defer
src="https://{{ script_domain }}/latest.js"
data-collect-dnt="true"
data-hostname="{{ hostname }}"></script>
<noscript>
<img src="https://{{ noscript_domain }}/noscript.gif?collect-dnt={{ collect_dnt }}&hostname={{ hostname }}&path={{ page.url }}"
alt=""
referrerpolicy="no-referrer-when-downgrade">
</noscript>
{% endif %}

0 comments on commit 773637d

Please sign in to comment.