PHPackages                             shakvaro/wp-insights - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. shakvaro/wp-insights

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

shakvaro/wp-insights
====================

Opt-in telemetry and usage analytics SDK for WordPress plugins. Privacy-first (consent required, off by default), fail-silent, and safe to bundle in many plugins via version negotiation.

v1.2.7(1mo ago)035GPL-2.0-or-laterPHPPHP &gt;=7.3

Since Jun 16Pushed 1mo agoCompare

[ Source](https://github.com/shakiltousif/wp-insights)[ Packagist](https://packagist.org/packages/shakvaro/wp-insights)[ Docs](https://shakvaro.com/wp-insights)[ RSS](/packages/shakvaro-wp-insights/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependenciesVersions (14)Used By (0)

Shakvaro WP Insights — WP SDK
=============================

[](#shakvaro-wp-insights--wp-sdk)

Reusable, opt-in telemetry / usage-analytics library for **any** WordPress plugin. Sends usage and diagnostic data to a Shakvaro Insights backend — only after the user explicitly consents.

- Namespace: `Shakvaro\WP\Insights`
- Privacy-first: opt-in only, OFF by default, two-tier consent, fail-silent, local assets.
- Safe to bundle in many plugins at once: the highest installed version boots once site-wide via version negotiation (no class-redeclare fatals).

Install
-------

[](#install)

### Via Composer (recommended)

[](#via-composer-recommended)

```
composer require shakvaro/wp-insights
```

Then make sure your plugin loads Composer's autoloader (which boots the SDK):

```
require_once __DIR__ . '/vendor/autoload.php';
```

> Composer autoloads only `load.php` (which registers this copy's version). The SDK classes are loaded by the internal version-negotiation loader — NOT by Composer's PSR-4 — so that when several plugins ship different versions, only the newest boots, once, for the whole site.

### Manual (no Composer)

[](#manual-no-composer)

Copy this folder into your plugin and include `load.php`:

```
require_once __DIR__ . '/vendor/shakvaro-wp-insights/load.php';
```

Integrate into a plugin
-----------------------

[](#integrate-into-a-plugin)

In your main plugin file:

```
// 1. Register this copy of the SDK (cheap; just records the version).
require_once __DIR__ . '/vendor/shakvaro-wp-insights/load.php';

// 2. Identify the plugin once the SDK has booted.
add_action( 'shakvaro_wp_insights_loaded', function () {
    \Shakvaro\WP\Insights\Insights::register( array(
        'slug'           => 'codecarebd-bkash-nagad-rocket-payoneer-gateway',
        'name'           => 'CodeCareBD - Payment Gateway',
        'version'        => '1.1',
        'plugin_file'    => __FILE__,
        'api_key'        => 'pk_codecarebd_xxx',     // public key (from the backend)
        'signing_secret' => 'the_server_secret_salt', // shared HMAC value (from the backend)
        'endpoint'       => 'https://track.shakvaro.cloud',
        'privacy_url'    => 'https://shakvaro.com/wp-insights/privacy', // shown in the consent notice
    ) )
    ->track_feature( 'gateway_bkash', function () {
        $s = get_option( 'woocommerce_ccd_bkash_settings' );
        return is_array( $s ) && ( $s['enabled'] ?? '' ) === 'yes';
    } )
    ->track_feature( 'advance_payment', function () {
        return get_option( 'ccd_enable_advance_payment', 'no' ) === 'yes';
    } )
    ->add_deactivation_survey();
} );
```

> `api_key` + `signing_secret` come from the backend `plugins` row (the seeder prints them). The signing\_secret is the server's `secret_salt`; it ships in the plugin and is used for HMAC request signing (spam-deterrence + rate-limiting, not hard auth).

Report (re)activations
----------------------

[](#report-reactivations)

After a user opts in, deactivates, then reactivates, the SDK cannot detect this automatically (the host isn't loaded when its own activation hook runs). Add one line to report it:

```
register_activation_hook( __FILE__, function () {
    \Shakvaro\WP\Insights\Insights::mark_activated( 'your-plugin-slug' );
} );
```

`mark_activated()` sets a lightweight flag. The SDK reads and clears it on the next `admin_init` and sends an `activation` ping — consent-gated, fail-silent.

What it does
------------

[](#what-it-does)

- Shows a two-tier opt-in admin notice (usage / marketing). Nothing is sent until the user opts in.
- On usage opt-in: sends an `install` ping, then a weekly `heartbeat` (WP-Cron).
- On (re)activation: sends an `activation` ping (requires `mark_activated()` call above).
- Collects: WP/PHP/MySQL/WooCommerce versions, theme, locale, multisite, server; plugin version; declared feature states; one-way hash of the site URL + site title. Admin email only on marketing opt-in.
- Deactivation survey → `deactivation` ping with reason.
- Opt-out / uninstall → `delete` ping + local cleanup.

Opt-out from the host plugin
----------------------------

[](#opt-out-from-the-host-plugin)

```
// Wire to a settings toggle:
do_action( 'shakvaro_insights_opt_out_' . 'your-plugin-slug' );
```

Files
-----

[](#files)

```
load.php                     version-registration shim (always included)
src/Loader.php               boots the highest version once
src/Insights.php             facade (register/plugins/get)
src/Plugin.php               per-plugin controller + fluent API
src/Consent.php              two-tier opt-in notice + state
src/Client.php               fail-silent HMAC-signed transport + payload
src/Scheduler.php            weekly heartbeat (WP-Cron)
src/DeactivationModal.php    "why leaving" survey
src/Uninstall.php            opt-out / cleanup
src/Collectors/*.php         Environment, Lifecycle, Features, Identity
assets/insights.css|js       local-only notice + modal assets

```

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance92

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

13

Last Release

40d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/19539d8903380f83f22c8be61241631e8f0e4adaf39984b92b27f417326bfa42?d=identicon)[shakiltousif](/maintainers/shakiltousif)

---

Top Contributors

[![shakiltousif](https://avatars.githubusercontent.com/u/66784772?v=4)](https://github.com/shakiltousif "shakiltousif (13 commits)")

---

Tags

pluginwordpressInsightswpanalyticstelemetryopt inusage-tracking

### Embed Badge

![Health badge](/badges/shakvaro-wp-insights/health.svg)

```
[![Health](https://phpackages.com/badges/shakvaro-wp-insights/health.svg)](https://phpackages.com/packages/shakvaro-wp-insights)
```

###  Alternatives

[ffraenz/private-composer-installer

A composer install helper for private packages

2321.7M5](/packages/ffraenz-private-composer-installer)[philippbaschke/acf-pro-installer

An install helper for Advanced Custom Fields PRO

278724.6k](/packages/philippbaschke-acf-pro-installer)[appsero/client

Appsero Client

25527.6k11](/packages/appsero-client)[balbuf/composer-wp

Manage WordPress core, plugins, and themes with composer.

173.6k](/packages/balbuf-composer-wp)[joanrodas/plubo-routes

WordPress routes made simple.

142.8k](/packages/joanrodas-plubo-routes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
