Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor google analytics #12

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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