Event Tracking

Learn how to track custom events on your website with Deepns.

What are Events?

Events are user interactions you want to track beyond basic pageviews. Examples include:

  • Button clicks
  • Form submissions
  • Video plays
  • Downloads
  • Purchases

Automatic Event Tracking

Deepns automatically tracks these events:

  • Pageviews - Every page visit
  • Outbound clicks - Links to external websites
  • File downloads - PDF, ZIP, and document downloads

Manual Event Tracking

Track custom events using the deepns JavaScript API:

deepns.track('event_name', {
  category: 'engagement',
  label: 'button_click',
  value: 1
});

Event Properties

Events can include these optional properties:

Property Type Description
category string Event category (e.g., ‘engagement’, ‘conversion’)
label string Event label for additional context
value number Numeric value associated with the event
metadata object Additional custom properties

Examples

Track Button Clicks

document.querySelector('#signup-button').addEventListener('click', () => {
  deepns.track('signup_click', {
    category: 'conversion',
    label: 'header_cta'
  });
});

Track Form Submissions

document.querySelector('#contact-form').addEventListener('submit', (e) => {
  deepns.track('form_submit', {
    category: 'engagement',
    label: 'contact_form',
    metadata: {
      form_type: 'contact'
    }
  });
});

Track Video Plays

const video = document.querySelector('#promo-video');

video.addEventListener('play', () => {
  deepns.track('video_play', {
    category: 'engagement',
    label: video.title,
    metadata: {
      video_id: video.dataset.id,
      duration: video.duration
    }
  });
});

Track E-commerce Purchases

deepns.track('purchase', {
  category: 'conversion',
  value: 99.99,
  metadata: {
    order_id: 'ORD-12345',
    product: 'Premium Plan',
    currency: 'USD'
  }
});

Best Practices

Naming Conventions

Use clear, consistent event names:

  • signup_click, video_play, purchase_complete
  • event1, button, thing_happened

Event Categories

Organize events into categories:

  • engagement - User interactions (clicks, scrolls, hovers)
  • conversion - Goal completions (signups, purchases)
  • navigation - Page flows and user journeys
  • error - Error tracking and diagnostics

Avoid Over-tracking

Don’t track too many events:

  • Track meaningful interactions only
  • Avoid tracking every mouse movement
  • Focus on business-critical events

Viewing Event Data

Access event data in your Deepns dashboard:

  1. Navigate to Analytics > Events
  2. Filter by date range and event name
  3. View event counts, trends, and top performers
  4. Export data for further analysis

Next Steps

Documentation