Skip to content

betterlytics/betterlytics-wordpress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Betterlytics for WordPress

Official WordPress plugin for Betterlytics - privacy-first, open source analytics.

Features

  • Automatic Script Injection - Adds the lightweight (<1KB) Betterlytics tracking script to your site
  • Modern Admin UI - Immersive, fast admin interface built with Tailwind CSS v4
  • WordPress Hooks Integration - Map WordPress actions to Betterlytics custom events

Installation

  1. Download the plugin and upload to /wp-content/plugins/betterlytics/
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Go to Settings > Betterlytics to configure

Configuration

General Settings

Setting Description
Enable Tracking Toggle tracking on/off
Site ID Your unique Site ID from the Betterlytics dashboard

Automated Configuration (CI/CD)

Need to configure the plugin via deployment pipelines, WP-CLI, or infrastructure-as-code? See CONFIGURATION.md for WP-CLI commands, environment variables, Ansible playbooks, and more.

Developer API

Sending Custom Events

You can send custom events from your theme or plugin:

// Queue an event to be sent on page load
add_action( 'wp_footer', function() {
    if ( ! Betterlytics_Options::is_tracking_enabled() ) {
        return;
    }
    ?>
    <script>
    betterlytics.event('custom-event', {
        category: 'engagement',
        value: 123
    });
    </script>
    <?php
});

Checking Tracking Status

if ( Betterlytics_Options::is_tracking_enabled() ) {
    // Tracking is active
}

Getting Plugin Options

$options = Betterlytics_Options::get_options();
// Returns: site_id, server_url, script_url, enabled, track_outbound, etc.

// Get a single option
$site_id = Betterlytics_Options::get( 'site_id' );

Requirements

  • WordPress 5.0+
  • PHP 7.4+
  • pnpm 9.0+ (for developers)

License

GPL v2 or later

Contributing

Contributions are welcome! See CONTRIBUTING.md for development setup, testing instructions, and guidelines.

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •