Get up and running with Open Source Site Tracking in under 5 minutes. This guide covers the fastest way to start tracking your open source projects.
Before you begin, ensure you have the following installed:
# Clone the repository
git clone https://github.com/AutoBotSolutions/Opensource-Site-Tracking.git
cd opensource-site-tracking
# Start all services with Docker Compose
docker-compose up -d
# Check the status
docker-compose ps
Add this snippet to your website's <head> section:
<script src="http://localhost:8000/tracking.js" data-project-id="your-project-id"></script>
That's it! You're now tracking your project in real-time.
# Clone the repository
git clone https://github.com/AutoBotSolutions/Opensource-Site-Tracking.git
cd opensource-site-tracking/backend
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Initialize database
python init_db.py
# Start the backend server
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# In a new terminal
cd opensource-site-tracking/frontend
# Install dependencies
npm install
# Start the frontend server
npm run dev
Copy your project ID and add the tracking script:
<!DOCTYPE html>
<html>
<head>
<title>Your Website</title>
<script src="http://localhost:8000/tracking.js"
data-project-id="your-project-id"></script>
</head>
<body>
<h1>Welcome to My Website</h1>
<!-- Your website content -->
</body>
</html>
Create a .env file in the backend directory:
# Database
DATABASE_URL=sqlite:///site_tracking.db
# Security
SECRET_KEY=your-secret-key-here
JWT_SECRET_KEY=your-jwt-secret-key
# Application
DEBUG=True
ENVIRONMENT=development
# Analytics
ANALYTICS_ENABLED=True
DATA_RETENTION_DAYS=365
Create a .env.local file in the frontend directory:
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_APP_NAME=Open Source Site Tracking
Customize tracking behavior:
// Advanced tracking configuration
SiteTracking.init({
projectId: 'your-project-id',
tracking: {
pageViews: true,
clicks: true,
scrolls: true,
forms: true
},
privacy: {
respectDoNotTrack: true,
anonymizeIp: true
}
});
<!-- Add to your blog template -->
<script src="http://localhost:8000/tracking.js"
data-project-id="blog-project-id"></script>
// Track product views
SiteTracking.track('product-view', {
productId: 'prod-123',
productName: 'Analytics Pro',
category: 'software',
price: 99.99
});
// Track purchases
SiteTracking.track('purchase', {
orderId: 'order-456',
products: [
{
productId: 'prod-123',
quantity: 1,
price: 99.99
}
],
total: 99.99
});
# Track API requests
import requests
def track_api_event(event_type, properties):
requests.post('http://localhost:8000/api/v1/events/your-project-id', {
'event_type': event_type,
'properties': properties
}, headers={
'Authorization': 'Bearer your-api-token'
})
# Usage
track_api_event('api_request', {
'endpoint': '/api/users',
'method': 'GET',
'status_code': 200
})
# Check Python version
python --version
# Check virtual environment
which python
# Reinstall dependencies
pip install -r requirements.txt --force-reinstall
# Check database
ls -la site_tracking.db
# Clear node modules
rm -rf node_modules package-lock.json
npm install
# Clear Next.js cache
rm -rf .next
npm run dev
// Enable debug mode
SiteTracking.debug(true);
// Check status
console.log(SiteTracking.getStatus());
// Test tracking
SiteTracking.track('test-event', { test: true });
# Recreate database
rm site_tracking.db
python init_db.py
# Check database connection
python -c "from app.database import get_db; print('Database OK')"
Now that you're up and running, consider:
# Essential Commands
docker-compose up -d
# Stop services
docker-compose down
# View logs
docker-compose logs -f
# Backend development
cd backend
python -m uvicorn main:app --reload
# Frontend development
cd frontend
npm run dev