Netlify Integration

Automatically inject Entrolytics analytics into your Netlify sites

Netlify Integration

The @entro314labs/netlify-plugin-entrolytics automatically injects Entrolytics analytics into your Netlify sites during the build process.

Features

  • Zero-config setup - Automatically injects tracking script into all HTML files
  • Build-time injection - No runtime performance impact
  • Static site support - Works with Hugo, Jekyll, Eleventy, Gatsby, Next.js (SSG), and more
  • Cross-domain tracking - Configure multiple domains
  • Privacy controls - Respect Do Not Track settings
  • Smart detection - Skips files that already have the script

Quick Start

Install via Netlify UI

  1. Go to your Netlify site dashboard
  2. Navigate to Site settingsBuild & deployPlugins
  3. Search for "Entrolytics"
  4. Click Install

Add Environment Variable

In your Netlify site settings:

  1. Go to Site settingsEnvironment variables
  2. Add ENTROLYTICS_WEBSITE_ID with your website ID
  3. Optionally add ENTROLYTICS_HOST for self-hosted instances
[[plugins]]
package = "@entro314labs/netlify-plugin-entrolytics"

  [plugins.inputs]
  websiteId = "your-website-id"
  host = "https://cloud.entrolytics.click"

Deploy Your Site

Trigger a new deploy. The plugin will inject the tracking script into all HTML files.

Installation Methods

Recommended for beginners

  1. Navigate to Plugins in your site settings
  2. Search for "Entrolytics"
  3. Click Install
  4. Configure via environment variables

Add to your netlify.toml file:

netlify.toml
[[plugins]]
package = "@entro314labs/netlify-plugin-entrolytics"

  [plugins.inputs]
  websiteId = "abc123-def456"
  host = "https://cloud.entrolytics.click"
  autoTrack = true

Commit and push to deploy.

npm install -D @entro314labs/netlify-plugin-entrolytics

Then add to netlify.toml:

[[plugins]]
package = "@entro314labs/netlify-plugin-entrolytics"

Configuration

Plugin Inputs

InputTypeDescriptionDefault
websiteIdstringYour Entrolytics website ID (required)ENTROLYTICS_WEBSITE_ID env var
hoststringEntrolytics host URLhttps://cloud.entrolytics.click
autoTrackbooleanAutomatically track page viewstrue
respectDntbooleanRespect Do Not Track settingfalse
injectInHeadbooleanInject in <head> vs before </body>true
domainsstringComma-separated domains for cross-domain tracking-

Environment Variables

VariableDescription
ENTROLYTICS_WEBSITE_IDYour Entrolytics website ID (required)
ENTROLYTICS_HOSTCustom Entrolytics host URL (optional)
ENTROLYTICS_DOMAINSCross-domain tracking domains (optional)

Configuration Examples

How It Works

The plugin runs during the onPostBuild lifecycle hook:

Build Complete

Your static site generator finishes building all HTML files.

Plugin Activation

The Netlify plugin is triggered automatically.

Script Injection

The plugin:

  • Scans the publish directory for all .html files
  • Injects the Entrolytics tracking script with your configuration
  • Skips files that already contain the script (prevents duplicates)

Deploy

Modified files are deployed to Netlify's CDN.

Supported Frameworks

This plugin works seamlessly with any static site generator:

FrameworkStatusNotes
HugoFully supported
JekyllFully supported
EleventyFully supported
GatsbyStatic export mode
Next.jsSSG/export mode
AstroStatic builds
DocusaurusFully supported
VuePressFully supported
MkDocsFully supported

For SPAs

If you're building a single-page application that doesn't generate multiple HTML files, consider using our framework-specific packages instead:

Manual Event Tracking

After the plugin injects the script, track custom events in your JavaScript:

// Track a custom event
window.entrolytics?.track('button_click', {
  button: 'signup',
  location: 'header'
});

// Identify a user
window.entrolytics?.identify('user-123', {
  email: 'user@example.com',
  plan: 'pro'
});

// Track revenue
window.entrolytics?.track('purchase', {
  revenue: 99.99,
  currency: 'USD'
}, 99.99);

Verification

Check Build Logs

In your Netlify build logs, look for:

Plugin "@entro314labs/netlify-plugin-entrolytics" installed
Entrolytics Analytics: Injected into 42 HTML files

Verify Script Injection

View the source of your deployed site and look for:

<script defer src="https://cloud.entrolytics.click/script.js"
        data-website-id="your-website-id"></script>

Check Dashboard

Visit your Entrolytics dashboard to see live traffic.

Troubleshooting

Local Development

The plugin only runs during Netlify builds. For local development:

Add the script tag to your HTML template:

<script
  defer
  src="https://cloud.entrolytics.click/script.js"
  data-website-id="your-website-id"
></script>

Use a framework-specific SDK for better DX:

npm install @entro314labs/entro-react

See SDK documentation for setup.

Migration from Manual Script

If you're currently using a manual script tag:

Remove Manual Script

Remove the Entrolytics script from your HTML templates.

Install Plugin

Add the plugin to netlify.toml or via the Netlify UI.

Deploy

The plugin will automatically inject the script during build.

Environment-Specific Configuration

Use different Website IDs for production and preview:

netlify.toml
[[plugins]]
package = "@entro314labs/netlify-plugin-entrolytics"

  [plugins.inputs]
  websiteId = "${ENTROLYTICS_WEBSITE_ID}"

Then set different environment variables:

  • Production: ENTROLYTICS_WEBSITE_ID=prod-id
  • Preview: ENTROLYTICS_WEBSITE_ID=staging-id

Support