Crazy Egg Event Tracking Setup | OpsBlu Docs

Crazy Egg Event Tracking Setup

Implement event tracking in Crazy Egg — custom events, ecommerce tracking, data layer configuration, and validation.

Event Tracking Setup

Enhance Crazy Egg's automatic tracking with custom events.

Using the CE2 API

Track Custom Events

// Basic event
if (typeof CE2 !== 'undefined') {
  CE2.track('event_name');
}

Safe Tracking Function

function trackCrazyEgg(eventName) {
  if (typeof CE2 !== 'undefined' && typeof CE2.track === 'function') {
    CE2.track(eventName);
  }
}

// Usage
trackCrazyEgg('button_click');

Common Event Patterns

Button Clicks

document.getElementById('cta').addEventListener('click', function() {
  trackCrazyEgg('cta_click');
});

Form Submissions

document.getElementById('signup-form').addEventListener('submit', function() {
  trackCrazyEgg('form_submit');
});

Scroll Milestones

let tracked = {};
window.addEventListener('scroll', function() {
  const scrollPercent = Math.round(
    (window.scrollY / (document.body.scrollHeight - window.innerHeight)) * 100
  );

  [25, 50, 75, 100].forEach(milestone => {
    if (scrollPercent >= milestone && !tracked[milestone]) {
      tracked[milestone] = true;
      trackCrazyEgg('scroll_' + milestone);
    }
  });
});

Goal Configuration

In Dashboard

  1. Go to Goals
  2. Click Add Goal
  3. Define conditions:
    • URL contains
    • Element click
    • Custom event

URL Goals

Track page visits as goals:

  • Thank you pages
  • Confirmation pages
  • Key landing pages

Click Goals

Track specific element clicks:

  • CTA buttons
  • Navigation items
  • Product actions