Use Cases & Examples

Learn how to leverage Ultimate Context API to build smarter applications.

Smart E-commerce Localization

Automatically detect a user's currency and verify if their location considers today a "Holiday" (affecting shipping).

const data = await client.enrich({ ip: userIP });

if (data.context.currency.code !== 'USD') {
  showCurrencyBanner(data.context.currency); // "Shop in EUR!"
}

if (data.context.holidays.is_holiday) {
  showShippingDelayWarning(data.context.holidays.name); 
  // "Shipping delayed due to Christmas Day"
}

Fraud Prevention Gate

Block high-risk traffic from TOR nodes or known proxy servers before they access your login page.

const { context } = await client.enrich({ ip: req.ip });

if (context.security.is_tor || context.security.risk_score > 80) {
    return res.status(403).send("Access Denied: High Risk detected");
}

Hyper-Personalized Content

Drive engagement with hyper-personalized experiences. Greet users with "Good Morning from [City]" or adapt your UI based on their local weather (e.g., suggesting indoor activities during rain). Make every visitor feel like a local.

const { location, context } = await client.enrich({ ip: userIP });

// Personalized Greeting
const greeting = `Good Morning from ${location.city}!`;

// Weather-based UI
if (context.weather.condition.includes('rain')) {
  recommendIndoorActivities();
} else if (context.weather.temp_c > 25) {
  recommendOutdoorGear();
}

Enhanced Analytics Logging

Turn anonymous traffic into actionable insights. Enrich every log entry with precise city-level location, connection type, and device specifics. Understand exactly where your users are coming from to optimize marketing spend and regional strategy.

// Middleware Logger
const logTraffic = async (req, next) => {
  const { location, context } = await client.enrich({ 
    ip: req.ip, 
    fields: 'location.city,context.device,context.security' 
  });

  analytics.track({
    event: 'Page View',
    userId: req.user?.id,
    metadata: {
      city: location.city,
      deviceType: context.device.type, // 'mobile' | 'desktop'
      isProxy: context.security.is_proxy
    }
  });
  
  next();
};