Crazy Egg Data Layer Setup | Blue Frog Docs

Crazy Egg Data Layer Setup

Configure user segments and custom data in Crazy Egg.

Data Layer Overview

Crazy Egg uses visual tracking primarily, but you can enhance data collection with user segments and custom variables.

 


 

User Identification

Setting User Variables

// Set user-level data
if (typeof CE2 !== 'undefined') {
  CE2.set('user_id', 'user123');
  CE2.set('plan', 'premium');
}

Segment by User Type

function setUserSegment(userData) {
  if (typeof CE2 !== 'undefined') {
    CE2.set('user_type', userData.type);
    CE2.set('subscription', userData.plan);
  }
}

 


 

Page-Level Data

Custom Page Variables

// Set page context
CE2.set('page_category', 'product');
CE2.set('page_section', 'electronics');

Dynamic Content

// For dynamic pages
CE2.set('product_id', productId);
CE2.set('price_range', getPriceRange());

 


 

Filtering and Segmentation

Using Variables in Reports

After setting variables:

  1. Go to Snapshot
  2. Click Filter
  3. Select your custom variable
  4. Apply segment

Common Segments

  • Logged in vs anonymous
  • Paid vs free users
  • New vs returning visitors
  • Traffic source segments

 


 

Best Practices

  • Set variables early in page load
  • Use consistent naming
  • Avoid PII in variable values
  • Document your segments
// SYS.FOOTER