Web Analytics

historic-country-borders-app

⭐ 166 stars English by nrgapple

Historic Borders

Visualize country borders from different times in history (2000 BC-1994)

As seen on r/dataisbeautiful.

Screenshot

screen-shot-of-app

Features

Information Sources

The app provides country information through two sources:

You can switch between these sources using the toggle button in the footer.

AI Response Caching

The app uses Redis to cache AI responses for improved performance:

See REDIS_SETUP.md for detailed setup instructions.

AI Feature Analytics

The app includes comprehensive Google Analytics tracking for the AI feature to understand user engagement and performance:

#### Tracked Events

Provider Usage:

AI Requests: Cache Performance: Content Display: Performance Metrics: #### Analytics Categories

All AI-related events use the category "AI Feature" for easy filtering in Google Analytics.

#### Data Privacy

Analytics tracking is anonymized and focuses on feature usage patterns rather than personal information. No API keys or sensitive data are tracked.

Setup

Prerequisites

Installation

git clone https://github.com/nrgapple/historic-country-borders-app.git
cd historic-country-borders-app
yarn install

Environment Variables

Create a .env.local file:

# Optional for analytics
NEXT_PUBLIC_GA_FOUR=your_google_analytics_id

Optional for map features

NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN=your_mapbox_token

Redis for AI response caching (required for caching)

REDIS_URL=your_redis_connection_string

Required for AI features (server-side only)

GEMINI_API_KEY=your_gemini_api_key_here

Getting API Keys

#### Google Gemini API (Free)

Benefits: #### Vercel Redis for Caching (Optional but Recommended)

Benefits: #### Google Analytics 4 (Optional)

Development

yarn dev

Open http://localhost:3000 to view the app.

Testing

# Run all tests
yarn test

Run tests in watch mode

yarn test:watch

Run specific test files

yarn test hooks/__tests__/useAI.test.tsx

AI Feature Troubleshooting

Common Issues

"AI information requires Gemini API key setup"

Slow AI responses Empty or error responses

Analytics Dashboard

To view AI feature analytics in Google Analytics:

Performance Monitoring

The app tracks several performance metrics:

Contributing

License

MIT License - see LICENSE for details.

Acknowledgments

--- Tranlated By Open Ai Tx | Last indexed: 2026-03-07 ---