OSGEO-Inject¶
Lightweight affiliate badge system for OSGeo community projects
Overview¶
OSGEO-Inject is a minimal, high-performance JavaScript widget that displays OSGeo affiliation badges and announcements on participating project websites. Designed with security and performance as the highest priorities, the entire payload is under 15KB and loads asynchronously to never impact host page performance.
graph LR
A[OSGeo Project Site] -->|loads| B[osgeo-inject.js]
B -->|fetches| C[announcement.json]
B -->|tracks| D[Matomo Analytics]
B -->|displays| E[OSGeo Badge]
Key Features¶
- Tiny Footprint: Under 15KB total (JS + CSS + images)
- Zero Dependencies: Pure JavaScript and CSS, no external libraries
- Security First: Strict CORS policies, CSP compliant
- Performance Optimized: Async loading, aggressive caching
- Accessible: WCAG 2.1 AA compliant
- Themeable: Light/dark mode support with auto-detection
- Analytics: Matomo integration for usage tracking
Quick Start¶
Add these two lines to your HTML:
<script
src="https://affiliate.osgeo.org/js/osgeo-inject.min.js"
defer
data-position="top-right"
></script>
<link
rel="stylesheet"
href="https://affiliate.osgeo.org/css/osgeo-inject.min.css"
/>
That's it! The OSGeo badge will appear in the specified position on your page.
Architecture¶
C4Context
title OSGEO-Inject System Context
Person(user, "Website Visitor", "Visits an OSGeo project website")
System(osgeo_project, "OSGeo Project Site", "Community project website")
System(inject_server, "OSGEO-Inject Server", "affiliate.osgeo.org")
System(matomo, "Matomo Analytics", "Usage tracking")
Rel(user, osgeo_project, "Visits")
Rel(osgeo_project, inject_server, "Loads JS/CSS/Images")
Rel(inject_server, matomo, "Tracks views")
How It Works¶
- Loading: The script loads asynchronously, never blocking page render
- Configuration: Reads options from
data-*attributes - Fetching: Retrieves current announcement from the server (cached for 1 hour)
- Rendering: Creates a minimal DOM structure for the badge
- Tracking: Sends a single pixel request to Matomo for analytics
Support This Project¶
This project is maintained by volunteers in the OSGeo community. If you find it useful, please consider supporting its development: