Location Analytics
curl --request GET \
--url https://jmpy.me/api/v1/qranalytics/locations \
--header 'Authorization: Bearer <token>'{
"countries": [
{
"country": "<string>",
"scans": 123,
"uniqueScanners": 123,
"percentage": 123
}
],
"cities": [
{
"country": "<string>",
"city": "<string>",
"scans": 123,
"uniqueScanners": 123
}
],
"totalScans": 123
}QR Code Analytics
Location Analytics
Get geographic analytics for QR code scans
GET
/
qranalytics
/
locations
Location Analytics
curl --request GET \
--url https://jmpy.me/api/v1/qranalytics/locations \
--header 'Authorization: Bearer <token>'{
"countries": [
{
"country": "<string>",
"scans": 123,
"uniqueScanners": 123,
"percentage": 123
}
],
"cities": [
{
"country": "<string>",
"city": "<string>",
"scans": 123,
"uniqueScanners": 123
}
],
"totalScans": 123
}Get geographic location breakdown of QR code scans including country and city distribution.
This endpoint returns user-level aggregated location data across all your QR codes. For location analytics on a specific QR code, use the Complete Analytics endpoint.
Query Parameters
Number of days to include in analytics (1-365).
Response
Total number of scans with location data.
Geographic analytics may be restricted based on your plan. Users on free plans may have limited access to city-level data. Upgrade to access full geographic analytics.
Request Examples
- cURL
- Node.js
- TypeScript
- Python
- PHP
- Go
- Java
# Get location analytics for last 30 days
curl -X GET "https://jmpy.me/api/v1/qranalytics/locations?days=30" \
-H "Authorization: Bearer YOUR_API_KEY"
# Get location analytics for last 90 days
curl -X GET "https://jmpy.me/api/v1/qranalytics/locations?days=90" \
-H "Authorization: Bearer YOUR_API_KEY"
const fetch = require('node-fetch');
const response = await fetch(
'https://jmpy.me/api/v1/qranalytics/locations?days=30',
{
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
}
);
const data = await response.json();
// Display country breakdown
console.log('Top Countries:');
data.data.countries.slice(0, 5).forEach(country => {
console.log(` ${country.country}: ${country.scans} (${country.percentage}%)`);
});
// Display city breakdown
console.log('\nTop Cities:');
data.data.cities.slice(0, 5).forEach(city => {
console.log(` ${city.city}, ${city.country}: ${city.scans} scans`);
});
import axios from 'axios';
interface LocationAnalytics {
countries: Array<{
country: string;
scans: number;
uniqueScanners: number;
percentage: number
}>;
cities: Array<{
country: string;
city: string;
scans: number;
uniqueScanners: number
}>;
totalScans: number;
}
const response = await axios.get<{ success: boolean; data: LocationAnalytics }>(
'https://jmpy.me/api/v1/qranalytics/locations',
{
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
params: { days: 30 }
}
);
const { countries, cities, totalScans } = response.data.data;
console.log(`Total scans: ${totalScans}`);
console.log(`Top country: ${countries[0]?.country}`);
console.log(`Top city: ${cities[0]?.city}`);
import requests
response = requests.get(
'https://jmpy.me/api/v1/qranalytics/locations',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={'days': 30}
)
data = response.json()['data']
print("Country Distribution:")
for country in data['countries'][:5]:
print(f" {country['country']}: {country['scans']} ({country['percentage']}%)")
print("\nTop Cities:")
for city in data['cities'][:5]:
print(f" {city['city']}, {city['country']}: {city['scans']} scans")
<?php
$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'https://jmpy.me/api/v1/qranalytics/locations', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY'
],
'query' => [
'days' => 30
]
]);
$data = json_decode($response->getBody(), true)['data'];
echo "Top Countries:\n";
foreach (array_slice($data['countries'], 0, 5) as $country) {
echo " {$country['country']}: {$country['scans']} ({$country['percentage']}%)\n";
}
?>
package main
import (
"fmt"
"net/http"
"net/url"
"io"
)
func main() {
baseURL := "https://jmpy.me/api/v1/qranalytics/locations"
params := url.Values{}
params.Add("days", "30")
req, _ := http.NewRequest("GET", baseURL+"?"+params.Encode(), nil)
req.Header.Add("Authorization", "Bearer YOUR_API_KEY")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.URI;
import java.net.http.HttpResponse;
HttpClient client = HttpClient.newHttpClient();
String url = "https://jmpy.me/api/v1/qranalytics/locations?days=30";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer YOUR_API_KEY")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
Response Examples
- 200 OK
- 401 Unauthorized
- 403 Feature Disabled
{
"success": true,
"data": {
"countries": [
{
"country": "United States",
"scans": 823,
"uniqueScanners": 650,
"percentage": 35.1
},
{
"country": "United Kingdom",
"scans": 456,
"uniqueScanners": 380,
"percentage": 19.4
},
{
"country": "Germany",
"scans": 312,
"uniqueScanners": 260,
"percentage": 13.3
},
{
"country": "Canada",
"scans": 234,
"uniqueScanners": 190,
"percentage": 10.0
}
],
"cities": [
{
"country": "United States",
"city": "New York",
"scans": 234,
"uniqueScanners": 189
},
{
"country": "United Kingdom",
"city": "London",
"scans": 189,
"uniqueScanners": 156
},
{
"country": "United States",
"city": "Los Angeles",
"scans": 145,
"uniqueScanners": 120
},
{
"country": "Germany",
"city": "Berlin",
"scans": 98,
"uniqueScanners": 82
}
],
"totalScans": 2345
}
}
{
"success": false,
"error": {
"code": "UNAUTHORIZED",
"message": "User authentication required"
}
}
{
"success": false,
"error": {
"code": "FEATURE_DISABLED",
"message": "Geographic analytics is not available on your current plan",
"details": {
"feature": "Geographic analytics",
"currentPlan": "Free"
}
}
}
Use Cases
Build a geographic heatmap
Build a geographic heatmap
Prepare location data for visualization on a map.
async function getMapData() {
const response = await fetch(
'https://jmpy.me/api/v1/qranalytics/locations?days=30',
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const { data } = await response.json();
// Format for map visualization
const countryData = data.countries.map(country => ({
name: country.country,
value: country.scans,
percentage: country.percentage
}));
return countryData;
}
Identify key markets
Identify key markets
Analyze which countries and cities drive the most QR engagement.
import requests
def identify_key_markets():
response = requests.get(
'https://jmpy.me/api/v1/qranalytics/locations?days=30',
headers={'Authorization': 'Bearer YOUR_API_KEY'}
)
data = response.json()['data']
# Top 3 countries represent key markets
key_markets = data['countries'][:3]
print("=== Key Market Analysis ===")
print("\nPrimary Markets (Country Level):")
for market in key_markets:
print(f" {market['country']}: {market['percentage']}% of traffic")
# Identify top city in each key market
print("\nTop Cities per Market:")
for market in key_markets:
top_city = next(
(c for c in data['cities'] if c['country'] == market['country']),
None
)
if top_city:
print(f" {market['country']}: {top_city['city']} ({top_city['scans']} scans)")
Regional performance comparison
Regional performance comparison
Compare QR performance across different regions.
async function compareRegionalPerformance() {
const response = await fetch(
'https://jmpy.me/api/v1/qranalytics/locations?days=30',
{ headers: { 'Authorization': 'Bearer YOUR_API_KEY' } }
);
const { data } = await response.json();
// Group countries by region
const regions: Record<string, number> = {
'North America': 0,
'Europe': 0,
'Asia': 0,
'Other': 0
};
const regionMap: Record<string, string> = {
'United States': 'North America',
'Canada': 'North America',
'Mexico': 'North America',
'United Kingdom': 'Europe',
'Germany': 'Europe',
'France': 'Europe',
'Japan': 'Asia',
'China': 'Asia',
'India': 'Asia'
};
data.countries.forEach(country => {
const region = regionMap[country.country] || 'Other';
regions[region] += country.scans;
});
console.log('Regional Performance:');
Object.entries(regions)
.sort((a, b) => b[1] - a[1])
.forEach(([region, scans]) => {
console.log(` ${region}: ${scans} scans`);
});
}
Related Endpoints
Device Analytics
Get device, browser, and OS breakdown
Recent Activity
See individual scan records with location info
Analytics Overview
Get aggregated summary statistics
Complete Analytics
Get all analytics for a specific QR code
⌘I