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:
- Install "Crazy Egg for WordPress" plugin
- Activate and enter account ID
- Save settings
Manual:
Add to theme's header.php before </head>
Shopify
- Admin → Online Store → Themes
- Actions → Edit code
- Open
theme.liquid - Paste before
</head> - Save
Squarespace
- Settings → Advanced → Code Injection
- Paste in Header section
- Save
Wix
- Settings → Tracking & Analytics
- + New Tool → Custom
- Paste code, set to all pages
- Apply
Tag Manager
Google Tag Manager
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
- View page source
- Search for "crazyegg"
- Verify script is present
Check Dashboard
- Log into Crazy Egg
- Go to your snapshot
- Verify visits are being recorded
Browser Console
// Check if loaded
typeof CE2 !== 'undefined' // Should return true