Add a Product

Get started with Oppla analytics in just a few simple steps. Track user behavior, feature usage, and experiments with a single lightweight script.

Quick Start

Step 1: Get Your Product Credentials

  1. Log into your Oppla Dashboard
  2. Navigate to My ProductsAdd Product
  3. Click Add Product
  4. Copy your Product ID and Account ID

Step 2: Add the Tracking Script

Add this script to your product’s <head> section:
<script async defer
  src="https://tracker.oppla.ai/script.js"
  data-website-id="YOUR_PRODUCT_ID"
  data-account-id="YOUR_ACCOUNT_ID">
</script>
That’s it! Oppla will automatically start tracking:
  • Page views
  • User sessions
  • Click events (with data-oppla-event attributes)
  • Feature flag usage
  • Experiment participation

Advanced Features

Track Custom Events

Track button clicks, form submissions, or any custom event:
<!-- Track button clicks -->
<button data-oppla-event="signup-clicked"
        data-oppla-event-plan="pro">
  Sign Up for Pro
</button>

<!-- Track form submissions -->
<form data-oppla-event="contact-form-submitted">
  <!-- your form fields -->
</form>

Identify Users

Track logged-in users across sessions:
// When user logs in
window.oppla.identify('user-123', {
  email: 'user@example.com',
  plan: 'premium',
  company: 'Oppla AI'
});

Feature Flags

Control feature visibility based on user segments:
// Check if a feature is enabled
if (window.oppla.getFeatureFlagStatus('new-dashboard')) {
  // Show new dashboard
}

A/B Testing

Run experiments to optimize your user experience:
// Get experiment variant
const variant = window.oppla.getExperimentStatus('homepage-cta');

if (variant === 'variant-a') {
  // Show variant A
} else if (variant === 'variant-b') {
  // Show variant B
}

Configuration

Configuration Options

Customize tracking behavior with optional attributes:
<script async defer
  src="https://tracker.oppla.ai/script.js"
  data-website-id="YOUR_PRODUCT_ID"
  data-account-id="YOUR_ACCOUNT_ID"
  data-auto-track="true"              <!-- Enable automatic tracking (default: true) -->
  data-exclude-search="true"          <!-- Exclude URL parameters (default: false) -->
  data-exclude-hash="true"            <!-- Exclude URL hash (default: false) -->
  data-do-not-track="true"            <!-- Respect browser DNT (default: false) -->
  data-domains="app.example.com,example.com">  <!-- Track specific domains -->
</script>

JavaScript API

Once installed, these methods are available globally:
// Track custom events
window.oppla.track('event-name', {
  property1: 'value1',
  property2: 'value2'
});

// Identify users
window.oppla.identify('user-id', {
  email: 'user@example.com',
  customProperty: 'value'
});

// Feature flags
const isEnabled = window.oppla.getFeatureFlagStatus('feature-id');

// Experiments
const variant = window.oppla.getExperimentStatus('experiment-id');

// Automation triggers
window.oppla.trigger('trigger-name', 'automation-id', {
  customData: 'value'
});

Verification

Testing the Installation

  1. Check the Console
    • Open browser Developer Tools (F12)
    • Type window.oppla in the Console
    • You should see the Oppla object with available methods
  2. Check Network Activity
    • Go to Network tab in Developer Tools
    • Look for requests to tracker.oppla.ai
    • Verify requests to /api/send are successful (200 status)
  3. Check Your Dashboard
    • Visit your Oppla Dashboard
    • Navigate to AnalyticsReal-time
    • You should see your current session

Common Issues

  • window.oppla is undefined: Ensure the script is in the <head> section and has loaded
  • No data in dashboard: Verify your Product ID and Account ID are correct
  • Blocked by ad blocker: Ask users to whitelist tracker.oppla.ai
  • Not tracking localhost: Localhost tracking is disabled by default for development

Next Steps