SILENT KILLERPanel

Current Path: > home > codekrsu > > ameliagraphics.com > wp-content > plugins > forminator > library > > lib > analytics


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: /home/codekrsu//ameliagraphics.com/wp-content/plugins/forminator/library//lib/analytics

NameTypeSizeLast ModifiedActions
core Directory - -
tests Directory - -
vendor_prefixed Directory - -
README.md File 2296 bytes June 03 2024 15:18:22.
autoload.php File 2150 bytes March 17 2025 17:29:02.
composer.json File 474 bytes March 17 2025 17:29:02.
composer.lock File 125329 bytes March 17 2025 17:29:02.
scoper.inc.php File 4412 bytes June 03 2024 15:18:22.

Reading File: /home/codekrsu//ameliagraphics.com/wp-content/plugins/forminator/library//lib/analytics/README.md

# WPMUDEV Analytics

This module:

### Tracks events:
The module counts the number of plugin’s events triggered in a day.
 
### Sets a limit:
Each plugin can set a limit.

### Prevents excess events: 
 
Once the limit is reached:

The module triggers a new event `exceeded_daily_limit` to Mixpanel.

The module stops sending all Mixpanel events from that site for 24 hours.

## Devs

This module exposes a single class `WPMUDEV_Analytics` which is a thin wrapper over the MixPanel class from the MixPanel composer dependency.

This means that all the methods that can be called on an instance of the MixPanel class can also be called on an instance of WPMUDEV_Analytics class. 

Internally WPMUDEV_Analytics keeps track of event counts and stops sending events if the limit is exceeded.

Please note that a scoped version of the composer dependency is already included within this package so it does not need to be included by plugins.

Example usage:
```
    if ( ! class_exists( 'WPMUDEV_Analytics' ) ) {
        require_once YOUR_SUBMODULES_DIR . '/wpmudev-analytics/autoload.php';
    }
    $analytics = new WPMUDEV_Analytics( 'slug', 'Plugin Name', $event_limit, $token, $mixpanel_options );
    $analytics->identify( 'unique_id' );
    $analytics->registerAll( $super_properties );
    $analytics->track($event, $properties);
```

## QA Testing

In production the limit will be high and when it is reached, the site will stop sending events for 24 hours.

To make testing convenient two constants have been included that can override the default behavior:

*WPMUDEV_ANALYTICS_EVENT_LIMIT*

This overrides the limit.

*WPMUDEV_ANALYTICS_TIME_WINDOW_SECONDS*

This overrides the time duration for which the site will be blocked from sending new events.

Let's say the following constants are defined:
```
define( 'WPMUDEV_ANALYTICS_TIME_WINDOW_SECONDS', 5 * 60 );
define( 'WPMUDEV_ANALYTICS_EVENT_LIMIT', 3 );
```
If more than 3 events are generated within 5 minutes then only 3 of those events will be tracked and one new `exceeded_daily_limit` event will be generated. 

The site will not send any new events for the rest of the current 5-minute window.

In other words when the above constants are defined then this module ensures that 3 _or fewer_ events are generated every 5 minutes.

SILENT KILLER Tool