Merge pull request #154 from Worklenz/chore/added-google-analytics
Chore/added google analytics
This commit is contained in:
21
README.md
21
README.md
@@ -192,6 +192,27 @@ Email [info@worklenz.com](mailto:info@worklenz.com) to disclose any security vul
|
|||||||
|
|
||||||
This project is licensed under the [MIT License](LICENSE).
|
This project is licensed under the [MIT License](LICENSE).
|
||||||
|
|
||||||
|
## Analytics
|
||||||
|
|
||||||
|
Worklenz uses Google Analytics to understand how the application is being used. This helps us improve the application and make better decisions about future development.
|
||||||
|
|
||||||
|
### What We Track
|
||||||
|
- Anonymous usage statistics
|
||||||
|
- Page views and navigation patterns
|
||||||
|
- Feature usage
|
||||||
|
- Browser and device information
|
||||||
|
|
||||||
|
### Privacy
|
||||||
|
- Analytics is opt-in only
|
||||||
|
- No personal information is collected
|
||||||
|
- Users can opt-out at any time
|
||||||
|
- Data is stored according to Google's privacy policy
|
||||||
|
|
||||||
|
### How to Opt-Out
|
||||||
|
If you've previously opted in and want to opt-out:
|
||||||
|
1. Clear your browser's local storage for the Worklenz domain
|
||||||
|
2. Or click the "Decline" button in the analytics notice if it appears
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Worklenz is a project management application built with React, TypeScript, and A
|
|||||||
- [Project Structure](#project-structure)
|
- [Project Structure](#project-structure)
|
||||||
- [Contributing](#contributing)
|
- [Contributing](#contributing)
|
||||||
- [Learn More](#learn-more)
|
- [Learn More](#learn-more)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
@@ -93,3 +94,7 @@ To learn more about the technologies used in this project:
|
|||||||
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)
|
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)
|
||||||
- [Ant Design Documentation](https://ant.design/docs/react/introduce)
|
- [Ant Design Documentation](https://ant.design/docs/react/introduce)
|
||||||
- [Vite Documentation](https://vitejs.dev/guide/)
|
- [Vite Documentation](https://vitejs.dev/guide/)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Worklenz is open source and released under the [GNU Affero General Public License Version 3 (AGPLv3)](LICENSE).
|
||||||
|
|||||||
@@ -14,6 +14,81 @@
|
|||||||
<title>Worklenz</title>
|
<title>Worklenz</title>
|
||||||
<!-- Environment configuration -->
|
<!-- Environment configuration -->
|
||||||
<script src="/env-config.js"></script>
|
<script src="/env-config.js"></script>
|
||||||
|
<!-- Google Analytics -->
|
||||||
|
<script>
|
||||||
|
// Function to initialize Google Analytics
|
||||||
|
function initGoogleAnalytics() {
|
||||||
|
// Load the Google Analytics script
|
||||||
|
const script = document.createElement('script');
|
||||||
|
script.async = true;
|
||||||
|
|
||||||
|
// Determine which tracking ID to use based on the environment
|
||||||
|
const isProduction = window.location.hostname === 'worklenz.com' ||
|
||||||
|
window.location.hostname === 'app.worklenz.com';
|
||||||
|
|
||||||
|
const trackingId = isProduction
|
||||||
|
? 'G-XXXXXXXXXX'
|
||||||
|
: 'G-3LM2HGWEXG'; // Open source tracking ID
|
||||||
|
|
||||||
|
script.src = `https://www.googletagmanager.com/gtag/js?id=${trackingId}`;
|
||||||
|
document.head.appendChild(script);
|
||||||
|
|
||||||
|
// Initialize Google Analytics
|
||||||
|
window.dataLayer = window.dataLayer || [];
|
||||||
|
function gtag(){dataLayer.push(arguments);}
|
||||||
|
gtag('js', new Date());
|
||||||
|
gtag('config', trackingId);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize analytics
|
||||||
|
initGoogleAnalytics();
|
||||||
|
|
||||||
|
// Function to show privacy notice
|
||||||
|
function showPrivacyNotice() {
|
||||||
|
const notice = document.createElement('div');
|
||||||
|
notice.style.cssText = `
|
||||||
|
position: fixed;
|
||||||
|
bottom: 16px;
|
||||||
|
right: 16px;
|
||||||
|
background: #222;
|
||||||
|
color: #f5f5f5;
|
||||||
|
padding: 12px 16px 10px 16px;
|
||||||
|
border-radius: 7px;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.18);
|
||||||
|
z-index: 1000;
|
||||||
|
max-width: 320px;
|
||||||
|
font-family: Inter, sans-serif;
|
||||||
|
border: 1px solid #333;
|
||||||
|
font-size: 0.95rem;
|
||||||
|
`;
|
||||||
|
notice.innerHTML = `
|
||||||
|
<div style="margin-bottom: 6px; font-weight: 600; color: #fff; font-size: 1rem;">Analytics Notice</div>
|
||||||
|
<div style="margin-bottom: 8px; color: #f5f5f5;">This app uses Google Analytics for anonymous usage stats. No personal data is tracked.</div>
|
||||||
|
<button id="analytics-notice-btn" style="padding: 5px 14px; background: #1890ff; color: white; border: none; border-radius: 3px; cursor: pointer; font-size: 0.95rem;">Got it</button>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(notice);
|
||||||
|
// Add event listener to button
|
||||||
|
const btn = notice.querySelector('#analytics-notice-btn');
|
||||||
|
btn.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
localStorage.setItem('privacyNoticeShown', 'true');
|
||||||
|
notice.remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait for DOM to be ready
|
||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Check if we should show the notice
|
||||||
|
const isProduction = window.location.hostname === 'worklenz.com' ||
|
||||||
|
window.location.hostname === 'app.worklenz.com';
|
||||||
|
const noticeShown = localStorage.getItem('privacyNoticeShown') === 'true';
|
||||||
|
|
||||||
|
// Show notice if not in production and not shown before
|
||||||
|
if (!isProduction && !noticeShown) {
|
||||||
|
showPrivacyNotice();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Reference in New Issue
Block a user