Tour Analytics

Learn how to track and analyze tour performance using Oppla’s analytics features.

Basic Usage

Track Tour Events

import { createTour } from '@oppla-ai/tours';

const tour = createTour({
  id: 'feature-tour',
  steps: [
    {
      type: 'tooltip',
      target: '#feature-button',
      content: 'Try our new feature!'
    }
  ],
  analytics: {
    trackViews: true,
    trackInteractions: true
  }
});

tour.start();

Track Custom Events

{
  type: 'tooltip',
  target: '#feature-button',
  content: 'Try our new feature!',
  analytics: {
    trackEvent: 'feature_tooltip_shown',
    properties: {
      feature_name: 'new-feature',
      step_index: 0
    }
  }
}

Advanced Features

Track User Interactions

{
  type: 'tooltip',
  target: '#feature-button',
  content: 'Try our new feature!',
  onShow: () => {
    window.oppla.track('tooltip_shown', {
      tour_id: 'feature-tour',
      step_index: 0
    });
  },
  onClick: () => {
    window.oppla.track('tooltip_clicked', {
      tour_id: 'feature-tour',
      step_index: 0
    });
  }
}

Track Tour Progress

{
  type: 'tooltip',
  target: '#feature-button',
  content: 'Try our new feature!',
  onComplete: () => {
    window.oppla.track('tour_step_completed', {
      tour_id: 'feature-tour',
      step_index: 0,
      time_spent: 5000 // milliseconds
    });
  }
}

Best Practices

  1. Be Consistent: Use consistent event names and properties
  2. Be Specific: Track meaningful user interactions
  3. Be Organized: Group related events logically
  4. Be Clean: Remove unused tracking code

Common Issues

Events Not Tracking

  • Check event names
  • Verify properties
  • Check initialization
  • Ensure proper timing

Data Quality

  • Validate event data
  • Check for duplicates
  • Monitor event volume
  • Review property values

Next Steps