Skip to content

Commit

Permalink
Merge pull request #12 from ontoportal/refactor_google_analytics
Browse files Browse the repository at this point in the history
Refactor google analytics
  • Loading branch information
alexskr committed Jun 23, 2023
2 parents a5054f5 + 958f227 commit 00611e4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
6 changes: 1 addition & 5 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ url: "https://ontoportal.org"
virtual_appliance_url: "https://ontoportal.github.io/documentation/administration/steps/getting_started"
demo_url: "https://demo.ontoportal.org"
baseurl: ''
google_analytics_key:
google_analytics_id: G-K28QEN0HVL
google_maps_javascript_api_key:
disqus_shortname:
support_mail: "[email protected]"
Expand Down Expand Up @@ -207,7 +207,3 @@ _comments:
highlight: Emphasis the text
color: The background colour used in the plan name and call to action.
new_window: Open link in new window

# Google Analytics
ga_tracking: G-40129Q9CS5
ga_tracking_anonymize_ip: true # Use GDPR compliant Google Analytics settings (true by default)
9 changes: 9 additions & 0 deletions _includes/analytics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', '{{ site.google_analytics_id }}');
</script>
11 changes: 3 additions & 8 deletions _layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@

{% seo %}
{% feed_meta %}
{% if jekyll.environment == 'production' and site.google_analytics_id %}
{% include analytics.html %}
{% endif %}

<link rel="stylesheet" href="{{ site.baseurl }}/css/screen.css">
<link rel="icon" type="image/png" href="{{ site.baseurl }}/favicon.png">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.4/tiny-slider.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/tiny-slider/2.9.2/min/tiny-slider.js"></script>
{% if jekyll.environment == 'production' and site.google_analytics_key != '' %}
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', '{{ site.google_analytics_key }}', 'auto');
ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>
{% endif %}
</head>
<body>
<header>
Expand Down

0 comments on commit 00611e4

Please sign in to comment.