Skip to content

Commit

Permalink
fix: google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
danielle-h committed Feb 7, 2024
1 parent 551a471 commit 35928cd
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/_includes/google-analytics.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XE6GY7G848"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
Expand Down
55 changes: 55 additions & 0 deletions docs/_includes/scripts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{%- if site.footer_scripts -%}
{%- for script in site.footer_scripts -%}
{%- if script contains "://" -%}
{%- capture script_path %}{{ script }}{% endcapture -%}
{%- else -%}
{%- capture script_path %}{{ script | absolute_url }}{% endcapture -%}
{%- endif -%}
<script src="{{ script_path }}"></script>
{%- endfor -%}
{%- else -%}
<script src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="{{ '/assets/js/main.min.js' | relative_url }}"></script>
<script src="https://use.fontawesome.com/releases/v5.0.12/js/all.js"></script>
{%- endif -%}

{%- if jekyll.environment == 'production' and site.google_analytics -%}
{% include google-analytics.html %}
{%- endif %}

{% if site.mathjax == true or site.mathjax.enable == true %}
<!-- MathJax -->
{% capture mathjaxjs %}https://cdn.jsdelivr.net/npm/mathjax@3/es5/{{ site.mathjax.combo | default: "tex-svg" }}.js{%
endcapture %}
<script>
// http://docs.mathjax.org/en/latest/upgrading/v2.html
MathJax = {
tex: {
tags: "{{ site.mathjax.tags | default: 'ams' }}" // eq numbering options: none, ams, all
},
options: {
renderActions: {
// for mathjax 3, handle <script "math/tex"> blocks inserted by kramdown
find: [10, function (doc) {
for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
const display = !!node.type.match(/; *mode=display/);
const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
const text = document.createTextNode('');
node.parentNode.replaceChild(text, node);
math.start = { node: text, delim: '', n: 0 };
math.end = { node: text, delim: '', n: 0 };
doc.math.push(math);
}
}, '']
}
}
}
</script>

<script type="text/javascript" id="MathJax-script" async src="{{ mathjaxjs }}"></script>
{% endif %}

{%- if page.layout == "search" -%}
{% include lunr-search-scripts.html %}
{%- endif -%}

0 comments on commit 35928cd

Please sign in to comment.