Skip to content

Get Started with Real User Monitoring

Real User Monitoring Preview

Get up and running with Optima's Real User Monitoring in under 5 minutes. This guide will walk you through creating your first project, integrating the SDK, and viewing your real user performance data.

Prerequisites

Before you begin, make sure you have:

  • A web application (any framework or vanilla JavaScript)
  • Basic knowledge of HTML/JavaScript
  • Access to your application's codebase

Step 1: Create Your Account

  1. Sign up at optimajs.com
  2. Verify your email address
  3. Create your organization or accept a team invitation
  4. Create your first project and get your API key

Try the Demo First

Want to explore Optima's features before setting up? Try our interactive sandbox with sample data.

Lab Testing Preview

Step 2: Install the SDK

Add this script to your HTML <head> section and replace YOUR_API_KEY with your actual one:

html
<script>
  (function(w, d, s, o) {
    w['OptimaSDK'] = o;
    w[o] = w[o] || function() {
      (w[o].q = w[o].q || []).push(arguments)
    };
    w[o].l = 1 * new Date();

    var a = d.createElement(s);
    a.async = 1;
    a.src = 'https://www.optimajs.com/optima-sdk.js';

    var m = d.getElementsByTagName(s)[0];
    m.parentNode.insertBefore(a, m);
  })(window, document, 'script', 'optima');

  optima('init', 'YOUR_API_KEY', {
    sampleRate: 100,
    endpoint: 'https://optima-server-579877642650.us-central1.run.app'
  });
</script>

Step 3: Release & Celebrate

Congrats! You’ve finished setup. Go ahead and deploy your changes, or just refresh your app and start clicking around—Optima is now tracking real user data. Enjoy your new performance superpowers! 🎉

Step 4: Basic Configuration

Lab Testing Preview

The SDK works with zero configuration, but you can customize it:

javascript
new Optima({
  apiKey: 'YOUR_API_KEY',
  endpoint: 'https://api.optimajs.com',
  sampleRate: 100,
  exclusionList: null,
});
OptionDescriptionDefaultRequiredExample
apiKeyYour Optima API keyRequiredYes'YOUR_API_KEY'
endpointThe Optima endpointhttps://optima-server-579877642650.us-central1.run.appYes'https://optima-server-579877642650.us-central1.run.app'
sampleRatePercentage of sessions to monitor (1-100)100Optional100
exclusionListArray of URL patterns to exclude from performance tracking (overrides default third-party exclusions)nullOptional['www.google-analytics.com', 'api.segment.io']

Step 4: User Identification (Optional)

Associate performance data with user information:

javascript
// Identify users to get better insights
optima('identify', {
  email: 'user@example.com',
  name: 'John Doe',
  plan: 'pro',
  userId: 'user_12345',
  company: 'Acme Corp',
  // Add any custom properties
  signupDate: '2025-01-15',
  userRole: 'admin'
});

🔧 Advanced Configuration

Custom Events

Track custom business metrics:

javascript
// Track custom events
optima('track', 'purchase_completed', {
  value: 99.99,
  currency: 'USD',
  items: 3
});

// Track user interactions
optima('track', 'button_clicked', {
  button_id: 'cta-header',
  page: '/pricing'
});

Performance Marks

Add custom timing marks:

javascript
// Mark important moments
performance.mark('checkout-start');
// ... checkout process
performance.mark('checkout-complete');

// Optima will automatically collect these marks

🚨 Troubleshooting

Common Issues

No data appearing in dashboard:

  • Check your API key is correct
  • Verify the SDK is loading (check Network tab)
  • Ensure you're not blocking the endpoint

Console errors:

  • Check for Content Security Policy restrictions
  • Verify the SDK URL is accessible
  • Ensure proper initialization order

Missing user journeys:

  • Enable enableRouteChangeTracking: true
  • For SPAs, ensure proper route change detection

✅ Next Steps

Now that you have RUM set up:

  1. Explore your dashboard - Familiarize yourself with the interface
  2. Set up alerts - Get notified when performance degrades
  3. Analyze user journeys - Understand how users navigate your app
  4. Optimize based on data - Use insights to improve performance
  5. Consider Lab Testing - Add controlled testing for complete coverage

Pro Tip

Combine RUM with our Lab Testing for comprehensive performance monitoring. RUM shows real-world performance while Lab Testing provides controlled analysis.