Installation
Lucky Orange is a conversion optimization platform that combines heatmaps, session recordings, live chat, and analytics. This guide covers all installation methods across different platforms.
Getting Your Site ID
Before installation, you'll need your Lucky Orange site ID:
- Log into your Lucky Orange account
- Go to Settings > Installation
- Find your unique site ID in the tracking code
- Copy your site ID (format:
a1b2c3d4)
Standard JavaScript Installation
The most common installation method for websites and web applications.
Basic Script
Add this code to your HTML <head> tag or just before the closing </body> tag:
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>Replace YOUR_SITE_ID with your actual Lucky Orange site ID.
Recommended Placement
Option 1: In the <head> (Recommended)
<head>
<meta charset="UTF-8">
<title>Your Website</title>
<!-- Lucky Orange Tracking Code -->
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>
</head>Option 2: Before </body>
<body>
<!-- Your content -->
<!-- Lucky Orange Tracking Code -->
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>
</body>Full Implementation Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Your Website</title>
<!-- Lucky Orange Tracking Code -->
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>
</head>
<body>
<h1>Welcome to Your Website</h1>
<!-- Your content -->
</body>
</html>WordPress Installation
Lucky Orange offers multiple installation methods for WordPress sites.
Method 1: Official Plugin (Recommended)
- Log into your WordPress admin dashboard
- Go to Plugins > Add New
- Search for "Lucky Orange"
- Click "Install Now" on the official Lucky Orange plugin
- Click "Activate"
- Go to Settings > Lucky Orange
- Enter your site ID
- Click "Save Changes"
Method 2: Manual Header/Footer Plugin
- Install "Insert Headers and Footers" plugin
- Go to Settings > Insert Headers and Footers
- Paste the Lucky Orange script in "Scripts in Header"
- Click "Save"
Method 3: Theme Functions
Add to your theme's functions.php:
function add_lucky_orange_tracking() {
?>
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>
<?php
}
add_action('wp_head', 'add_lucky_orange_tracking');Method 4: Direct Theme Edit
Edit your theme's header.php (not recommended for theme updates):
<!-- Add before closing </head> tag -->
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>Shopify Installation
Install Lucky Orange on your Shopify store.
Installation Steps
Access Theme Code
- Go to Online Store > Themes
- Click Actions > Edit code
Locate Theme File
- Find
theme.liquidin the Layout folder - Click to open the file
- Find
Add Tracking Code
- Scroll to find the
</head>tag - Add the Lucky Orange script just before
</head>:
- Scroll to find the
<!-- Lucky Orange Tracking Code -->
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>
</head>- Save Changes
- Click "Save" in the top right
- Visit your store to verify installation
Shopify App Alternative
Lucky Orange also offers a Shopify app:
- Visit the Shopify App Store
- Search for "Lucky Orange"
- Click "Add app"
- Follow installation prompts
Wix Installation
Using Wix Embed
- Go to your Wix dashboard
- Click on "Add" in the left sidebar
- Select "Embed" > "Custom Embeds" > "Embed Code"
- Paste the Lucky Orange script
- Adjust the embed size and position
- Publish your site
Using Tracking & Analytics
- Go to Settings > Tracking & Analytics
- Click "+ New Tool" > "Custom"
- Paste the Lucky Orange script
- Set to load on "All Pages"
- Click "Apply"
Squarespace Installation
Code Injection Method
- Go to Settings > Advanced > Code Injection
- Paste the Lucky Orange script in the Header section:
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>- Click "Save"
Per-Page Installation
For specific pages only:
- Go to the page settings
- Click Advanced
- Paste the script in "Page Header Code Injection"
Google Tag Manager Installation
Install Lucky Orange via GTM for easier management.
GTM Setup Steps
Create Custom HTML Tag
- In GTM, go to Tags > New
- Click Tag Configuration
- Choose "Custom HTML"
Add Script
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>Configure Trigger
- Click Triggering
- Select "All Pages" for site-wide tracking
- Or create custom triggers for specific pages
Name and Save
- Name your tag "Lucky Orange Tracking"
- Click "Save"
Publish Container
- Click "Submit" in GTM
- Add version name and description
- Click "Publish"
Advanced GTM Configuration
Track only authenticated users:
<script>
// Only load Lucky Orange for logged-in users
if ({{User Status}} === 'logged-in') {
(function() {
var script = document.createElement('script');
script.async = true;
script.defer = true;
script.src = 'https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID';
document.head.appendChild(script);
})();
}
</script>React Integration
Using useEffect Hook
import { useEffect } from 'react';
function App() {
useEffect(() => {
// Load Lucky Orange script
const script = document.createElement('script');
script.src = 'https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID';
script.async = true;
script.defer = true;
document.head.appendChild(script);
return () => {
// Cleanup on unmount
document.head.removeChild(script);
};
}, []);
return <div>Your App</div>;
}React Helmet
import { Helmet } from 'react-helmet';
function App() {
return (
<>
<Helmet>
<script
async
defer
src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"
/>
</Helmet>
<div>Your App</div>
</>
);
}Next.js Integration
Using Script Component
// pages/_app.js
import Script from 'next/script';
function MyApp({ Component, pageProps }) {
return (
<>
<Script
src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"
strategy="afterInteractive"
/>
<Component {...pageProps} />
</>
);
}
export default MyApp;Document Integration
// pages/_document.js
import { Html, Head, Main, NextScript } from 'next/document';
export default function Document() {
return (
<Html>
<Head>
<script
async
defer
src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"
/>
</Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}Vue Integration
Vue 3 Plugin
// plugins/luckyOrange.js
export default {
install: (app) => {
const script = document.createElement('script');
script.src = 'https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID';
script.async = true;
script.defer = true;
document.head.appendChild(script);
}
};// main.js
import { createApp } from 'vue';
import App from './App.vue';
import LuckyOrange from './plugins/luckyOrange';
const app = createApp(App);
app.use(LuckyOrange);
app.mount('#app');Angular Integration
Add to index.html
<!-- src/index.html -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Your App</title>
<base href="/">
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>
</head>
<body>
<app-root></app-root>
</body>
</html>Webflow Installation
Site-Wide Installation
- Go to Project Settings
- Click on the "Custom Code" tab
- Paste the Lucky Orange script in the "Head Code" section:
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>- Click "Save Changes"
- Publish your site
Page-Specific Installation
- Open the page in the Designer
- Click the gear icon for Page Settings
- Scroll to Custom Code
- Add the script to "Head Code"
Ghost CMS Installation
Code Injection
- Go to Settings > Code Injection
- Add to Site Header:
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>- Click "Save"
Magento Installation
Magento 2
- Go to Content > Design > Configuration
- Select your store view
- Expand "HTML Head"
- Add to "Scripts and Style Sheets":
<script async defer src="https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID"></script>- Click "Save Configuration"
- Clear cache
BigCommerce Installation
Script Manager
- Go to Storefront > Script Manager
- Click "Create a Script"
- Name: "Lucky Orange Tracking"
- Location: "Head"
- Select pages: "All pages"
- Script type: "Script"
- Paste the Lucky Orange script
- Click "Save"
Drupal Installation
Using Custom Block
- Go to Structure > Block Layout
- Click "Add custom block"
- Block type: "Basic block"
- Block description: "Lucky Orange Tracking"
- Body field: Paste the Lucky Orange script
- Text format: "Full HTML"
- Save and place in a region that appears on all pages
Conditional Loading
Load Only on Specific Pages
<script>
// Only load on specific pages
const currentPath = window.location.pathname;
const trackedPages = ['/checkout', '/products', '/contact'];
if (trackedPages.some(page => currentPath.includes(page))) {
const script = document.createElement('script');
script.src = 'https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID';
script.async = true;
script.defer = true;
document.head.appendChild(script);
}
</script>Load Only for Authenticated Users
<script>
// Check if user is logged in
if (window.currentUser && window.currentUser.isAuthenticated) {
const script = document.createElement('script');
script.src = 'https://tools.luckyorange.com/core/lo.js?site-id=YOUR_SITE_ID';
script.async = true;
script.defer = true;
document.head.appendChild(script);
}
</script>Verification and Testing
Browser Console Check
// Check if Lucky Orange loaded
console.log(window._loq);
// Should output an array if loaded correctlyNetwork Tab Verification
- Open browser DevTools (F12)
- Go to Network tab
- Reload the page
- Filter for "luckyorange"
- Look for request to
tools.luckyorange.com/core/lo.js
Dashboard Verification
- Log into Lucky Orange
- Go to Dashboard
- Look for "Live Visitors" count
- Visit your website in another tab
- Check if your visit appears in real-time
Troubleshooting
Script Not Loading
Check console for errors
- Open DevTools console
- Look for JavaScript errors
- Verify site ID is correct
Check Content Security Policy
- Ensure CSP allows scripts from
tools.luckyorange.com - Add to CSP if needed:
Content-Security-Policy: script-src 'self' https://tools.luckyorange.com;No Recordings Appearing
Verify installation
- Check that script is present on all pages
- Ensure site ID is correct
- Check browser console for errors
Check recording settings
- Log into Lucky Orange dashboard
- Go to Settings > Recording Settings
- Verify recording is enabled
Ad blocker interference
- Test in incognito mode
- Ask users to whitelist your domain
Live Chat Not Showing
Check chat settings
- Go to Settings > Chat Settings
- Verify chat is enabled
- Check display rules
Position and styling
Privacy and Compliance
GDPR Compliance
Lucky Orange provides GDPR compliance options:
- Visitor data anonymization
- Opt-out mechanisms
- Data retention controls
Configure in Settings > Privacy.
Excluding Sensitive Data
Prevent Lucky Orange from recording sensitive fields:
<input type="password" class="lo-ignore" />
<input type="text" data-lo-ignore="true" />Additional Resources
- Lucky Orange Event Tracking
- Lucky Orange Overview
- Lucky Orange Troubleshooting
- Official Documentation: luckyorange.com/support