Add documentation to explain how website analytics (such as Google Analytics or similar services) are integrated, configured, and maintained for the site.
Details
- Document where the analytics tracking code is found in the codebase.
- Provide setup and configuration steps for analytics tracking (e.g., adding a tracking ID to _config.yml or templates).
- List any privacy considerations or data handling information for analytics.
- Explain how to update, disable, or change analytics integrations.
- Ensure new contributors understand analytics usage and responsibilities.
Implementation Examples
1. Update _config.yml to include analytics configuration:
title: Melkamu Gishu
description: Senior Data Scientist
url: "https://melkyed.github.io"
baseurl: ""
# Analytics Configuration
analytics:
google_analytics_id: "G-XXXXXXXXXX" # Add your Google Analytics tracking ID
enabled: true # Set to false to disable tracking
plugins:
- jekyll-seo-tag
2. Create a reusable analytics include file (_includes/analytics.html):
{% if site.analytics.enabled %}
<!-- Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google_analytics_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{ site.analytics.google_analytics_id }}');
</script>
{% endif %}
3. Add analytics to the main layout (_layouts/default.html):
<!DOCTYPE html>
<html>
<head>
<!-- existing head content -->
{% include analytics.html %}
</head>
<body>
<!-- page content -->
</body>
</html>
4. Update README.md with analytics section:
## 📊 Analytics Configuration
This site uses Google Analytics to track visitor engagement and site performance.
### Setup
1. Obtain a Google Analytics tracking ID from https://analytics.google.com
2. Add the tracking ID to _config.yml: `google_analytics_id: "G-XXXXXXXXXX"`
3. Set `analytics.enabled: true` in _config.yml to activate tracking
### Privacy
- Analytics data is used solely for site performance metrics
- No personal information is collected beyond standard analytics
- Visitors can opt-out using browser privacy settings
### Disabling Analytics
- Set `analytics.enabled: false` in _config.yml
- Rebuild and deploy the site
Acceptance Criteria
Add documentation to explain how website analytics (such as Google Analytics or similar services) are integrated, configured, and maintained for the site.
Details
Implementation Examples
1. Update _config.yml to include analytics configuration:
2. Create a reusable analytics include file (_includes/analytics.html):
{% if site.analytics.enabled %} <!-- Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google_analytics_id }}"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '{{ site.analytics.google_analytics_id }}'); </script> {% endif %}3. Add analytics to the main layout (_layouts/default.html):
4. Update README.md with analytics section:
Acceptance Criteria