Installation Guide
Install Segmently on your website in under 60 seconds. Choose your platform below.
Vanilla HTML/JavaScript
Add this single line to your HTML <head> tag:
<!-- Add to <head> -->
<script
src="https://cdn.segmently.com/segmently.js"
data-api-key="YOUR_API_KEY"
async>
</script>Replace YOUR_API_KEY with your actual API key from the dashboard.
React / Next.js
Option 1: Using Script Tag (Recommended)
Add to your root layout or _app.tsx:
import Script from 'next/script'
export default function RootLayout({ children }) {
return (
<html>
<head>
<Script
src="https://cdn.segmently.com/segmently.js"
data-api-key="YOUR_API_KEY"
strategy="afterInteractive"
/>
</head>
<body>{children}</body>
</html>
)
}Option 2: Using NPM Package
npm install @segmently/react
// In your app:
import { SegmentlyProvider } from '@segmently/react'
function App() {
return (
<SegmentlyProvider apiKey="YOUR_API_KEY">
<YourApp />
</SegmentlyProvider>
)
}WordPress
Two installation methods:
Method 1: Using Header/Footer Plugin
- Install "Insert Headers and Footers" plugin
- Go to Settings → Insert Headers and Footers
- Paste the snippet in "Scripts in Header"
- Save changes
Method 2: Manual (theme's functions.php)
function add_segmently_script() {
?>
<script
src="https://cdn.segmently.com/segmently.js"
data-api-key="YOUR_API_KEY"
async>
</script>
<?php
}
add_action('wp_head', 'add_segmently_script');Shopify
- Go to your Shopify admin
- Click Online Store → Themes
- Click Actions → Edit code
- Find
theme.liquidin Layout folder - Add the snippet just before
</head> - Click Save
<!-- Add before </head> -->
<script
src="https://cdn.segmently.com/segmently.js"
data-api-key="YOUR_API_KEY"
async>
</script>
</head>Webflow
- Open your Webflow project
- Go to Project Settings (gear icon)
- Click Custom Code
- Paste in "Head Code" section
- Publish your site
Wix
- Open your Wix site editor
- Click Settings in the top menu
- Click Advanced → Custom Code
- Click "+ Add Custom Code"
- Paste the snippet
- Select "Head" and "All pages"
- Click Apply
Squarespace
- Go to your Squarespace dashboard
- Click Settings → Advanced → Code Injection
- Paste in "Header" section
- Click Save
Vue.js
Add to your main index.html:
<!DOCTYPE html>
<html>
<head>
<script
src="https://cdn.segmently.com/segmently.js"
data-api-key="YOUR_API_KEY"
async>
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>Angular
Add to your index.html in the src folder:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Your App</title>
<script
src="https://cdn.segmently.com/segmently.js"
data-api-key="YOUR_API_KEY"
async>
</script>
</head>
<body>
<app-root></app-root>
</body>
</html>Google Tag Manager
- Go to your GTM workspace
- Click Tags → New
- Choose "Custom HTML" tag type
- Paste the snippet
- Set trigger to "All Pages"
- Save and publish
Verifying Installation
After installing, verify it's working:
- Visit your website
- Open browser DevTools (F12)
- Go to Console tab
- Look for:
✅ Segmently loaded successfully
Or check your Segmently dashboard - you should see visitor data within 60 seconds.
Verify Installation
After adding the snippet to your website, verify it's working correctly:
- Open your website in a browser
- Press F12 to open Developer Tools
- Go to the Console tab
- Type:
window.segmentlyand press Enter - Success: If you see an object with properties like
version,track, etc., the snippet is installed correctly ✓ - Error: If you see
undefined, check that:- The snippet code was added correctly to your HTML
- Your API key is correct
- The page has fully loaded
Next Steps
Need Help?
Can't find your platform? Email us at support@segmently.com and we'll help you get set up.