Appearance
Analytics
Track scan activity for your dynamic QR codes with detailed analytics.
Overview
Every time someone scans one of your dynamic QR codes, we record:
- Timestamp
- Geographic location (country, city)
- Device type (mobile, desktop, tablet)
- Browser and OS
- Referrer (if available)
Endpoint
GET /api/analytics?linkId={linkId}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
linkId | string | ✅ | ID of the dynamic link |
startDate | string | - | Filter scans from this date (ISO 8601) |
endDate | string | - | Filter scans until this date (ISO 8601) |
limit | number | - | Max results to return (default: 100) |
Response
json
{
"link": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Winter Campaign",
"shortCode": "abc123",
"targetUrl": "https://example.com/winter-sale",
"scanCount": 1247
},
"analytics": {
"totalScans": 1247,
"uniqueScans": 892,
"scansByDay": [
{ "date": "2024-01-15", "scans": 156 },
{ "date": "2024-01-14", "scans": 203 },
{ "date": "2024-01-13", "scans": 178 }
],
"scansByCountry": [
{ "country": "US", "scans": 523 },
{ "country": "GB", "scans": 234 },
{ "country": "DE", "scans": 156 }
],
"scansByDevice": [
{ "device": "mobile", "scans": 892 },
{ "device": "desktop", "scans": 298 },
{ "device": "tablet", "scans": 57 }
],
"scansByBrowser": [
{ "browser": "Safari", "scans": 456 },
{ "browser": "Chrome", "scans": 523 },
{ "browser": "Firefox", "scans": 156 }
]
},
"recentScans": [
{
"id": "scan-123",
"timestamp": "2024-01-15T14:23:45Z",
"country": "US",
"city": "San Francisco",
"device": "mobile",
"browser": "Safari",
"os": "iOS",
"referrer": null
}
]
}Examples
Get All Analytics
bash
curl "https://www.qrcodeapi.io/api/analytics?linkId=550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer YOUR_API_KEY"Filter by Date Range
bash
curl "https://www.qrcodeapi.io/api/analytics" \
-H "Authorization: Bearer YOUR_API_KEY" \
-G \
--data "linkId=550e8400-e29b-41d4-a716-446655440000" \
--data "startDate=2024-01-01" \
--data "endDate=2024-01-31"JavaScript Example
javascript
async function getAnalytics(linkId, options = {}) {
const params = new URLSearchParams({ linkId });
if (options.startDate) params.append('startDate', options.startDate);
if (options.endDate) params.append('endDate', options.endDate);
if (options.limit) params.append('limit', options.limit);
const response = await fetch(
`https://www.qrcodeapi.io/api/analytics?${params}`,
{
headers: {
'Authorization': `Bearer ${API_KEY}`
}
}
);
return response.json();
}
// Usage
const analytics = await getAnalytics('550e8400-e29b-41d4-a716-446655440000', {
startDate: '2024-01-01',
endDate: '2024-01-31'
});
console.log(`Total scans: ${analytics.analytics.totalScans}`);
console.log(`Top country: ${analytics.analytics.scansByCountry[0].country}`);Python Example
python
import requests
from datetime import datetime, timedelta
def get_analytics(link_id, start_date=None, end_date=None):
params = {'linkId': link_id}
if start_date:
params['startDate'] = start_date
if end_date:
params['endDate'] = end_date
response = requests.get(
'https://www.qrcodeapi.io/api/analytics',
params=params,
headers={'Authorization': f'Bearer {API_KEY}'}
)
return response.json()
# Get last 30 days
end = datetime.now()
start = end - timedelta(days=30)
analytics = get_analytics(
'550e8400-e29b-41d4-a716-446655440000',
start_date=start.strftime('%Y-%m-%d'),
end_date=end.strftime('%Y-%m-%d')
)
print(f"Total scans: {analytics['analytics']['totalScans']}")Analytics Dashboard
For visual analytics, visit your Dashboard:
- Interactive charts
- Export to CSV
- Real-time updates
- Custom date ranges
Data Retention
| Plan | Retention Period |
|---|---|
| Free | 30 days |
| Starter | 90 days |
| Pro | 1 year |
| Enterprise | Unlimited |
Privacy Considerations
Analytics are collected in compliance with GDPR and CCPA:
- No personally identifiable information stored
- IP addresses are anonymized
- Location is approximate (city-level)
- Users can opt-out via browser settings
See our Privacy Policy for details.
Plan Availability
| Feature | Free | Starter | Pro | Enterprise |
|---|---|---|---|---|
| Scan count | ✅ | ✅ | ✅ | ✅ |
| Daily breakdown | ❌ | ✅ | ✅ | ✅ |
| Location data | ❌ | ✅ | ✅ | ✅ |
| Device data | ❌ | ✅ | ✅ | ✅ |
| Export to CSV | ❌ | ❌ | ✅ | ✅ |
| Real-time | ❌ | ❌ | ✅ | ✅ |
| Custom reports | ❌ | ❌ | ❌ | ✅ |
Related
- Dynamic Links - Create trackable QR codes
- Track QR Code Scans - Step-by-step guide
- Dashboard - Visual analytics