Install Crazy Egg Tracking Code | Blue Frog Docs

Install Crazy Egg Tracking Code

Step-by-step installation instructions for Crazy Egg on any website.

Installation Methods

Add Crazy Egg to your website using your preferred method.

 


 

Direct Installation

Standard JavaScript

Add before </head> on all pages:

<script type="text/javascript">
  setTimeout(function(){
    var a=document.createElement("script");
    var b=document.getElementsByTagName("script")[0];
    a.src=document.location.protocol+"//script.crazyegg.com/pages/scripts/XXXX/XXXX.js";
    a.async=true;a.type="text/javascript";
    b.parentNode.insertBefore(a,b)
  }, 1);
</script>

Replace XXXX/XXXX with your account-specific values from the dashboard.

 


 

CMS Installation

WordPress

Using Plugin:

  1. Install "Crazy Egg for WordPress" plugin
  2. Activate and enter account ID
  3. Save settings

Manual: Add to theme's header.php before </head>

Shopify

  1. Admin → Online StoreThemes
  2. ActionsEdit code
  3. Open theme.liquid
  4. Paste before </head>
  5. Save

Squarespace

  1. SettingsAdvancedCode Injection
  2. Paste in Header section
  3. Save

Wix

  1. SettingsTracking & Analytics
  2. + New ToolCustom
  3. Paste code, set to all pages
  4. Apply

 


 

Tag Manager

Google Tag Manager

  1. Create Custom HTML tag
  2. Paste Crazy Egg script
  3. Trigger: All Pages
  4. Publish

Other Tag Managers

Works with any tag manager supporting custom HTML/JavaScript.

 


 

Single-Page Applications

React/Vue/Angular

Crazy Egg tracks SPAs automatically when URLs change. For virtual pageviews:

// Notify Crazy Egg of page change
if (typeof CE2 !== 'undefined') {
  CE2.reload();
}

React Router Example

import { useEffect } from 'react';
import { useLocation } from 'react-router-dom';

function App() {
  const location = useLocation();

  useEffect(() => {
    if (typeof CE2 !== 'undefined') {
      CE2.reload();
    }
  }, [location]);

  return <YourApp />;
}

 


 

Verification

Confirm Installation

  1. View page source
  2. Search for "crazyegg"
  3. Verify script is present

Check Dashboard

  1. Log into Crazy Egg
  2. Go to your snapshot
  3. Verify visits are being recorded

Browser Console

// Check if loaded
typeof CE2 !== 'undefined'  // Should return true
// SYS.FOOTER