Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wp-smush.../core/external/wpmudev-...
File: README.md
# WPMUDEV Analytics
[0] Fix | Delete
[1] Fix | Delete
This module:
[2] Fix | Delete
[3] Fix | Delete
### Tracks events:
[4] Fix | Delete
The module counts the number of plugin’s events triggered in a day.
[5] Fix | Delete
[6] Fix | Delete
### Sets a limit:
[7] Fix | Delete
Each plugin can set a limit.
[8] Fix | Delete
[9] Fix | Delete
### Prevents excess events:
[10] Fix | Delete
[11] Fix | Delete
Once the limit is reached:
[12] Fix | Delete
[13] Fix | Delete
The module triggers a new event `exceeded_daily_limit` to Mixpanel.
[14] Fix | Delete
[15] Fix | Delete
The module stops sending all Mixpanel events from that site for 24 hours.
[16] Fix | Delete
[17] Fix | Delete
## Devs
[18] Fix | Delete
[19] Fix | Delete
This module exposes a single class `WPMUDEV_Analytics` which is a thin wrapper over the MixPanel class from the MixPanel composer dependency.
[20] Fix | Delete
[21] Fix | Delete
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.
[22] Fix | Delete
[23] Fix | Delete
Internally WPMUDEV_Analytics keeps track of event counts and stops sending events if the limit is exceeded.
[24] Fix | Delete
[25] Fix | Delete
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.
[26] Fix | Delete
[27] Fix | Delete
Example usage:
[28] Fix | Delete
```
[29] Fix | Delete
if ( ! class_exists( 'WPMUDEV_Analytics' ) ) {
[30] Fix | Delete
require_once YOUR_SUBMODULES_DIR . '/wpmudev-analytics/autoload.php';
[31] Fix | Delete
}
[32] Fix | Delete
$analytics = new WPMUDEV_Analytics( 'slug', 'Plugin Name', $event_limit, $token, $mixpanel_options );
[33] Fix | Delete
$analytics->identify( 'unique_id' );
[34] Fix | Delete
$analytics->registerAll( $super_properties );
[35] Fix | Delete
$analytics->track($event, $properties);
[36] Fix | Delete
```
[37] Fix | Delete
[38] Fix | Delete
## QA Testing
[39] Fix | Delete
[40] Fix | Delete
In production the limit will be high and when it is reached, the site will stop sending events for 24 hours.
[41] Fix | Delete
[42] Fix | Delete
To make testing convenient two constants have been included that can override the default behavior:
[43] Fix | Delete
[44] Fix | Delete
*WPMUDEV_ANALYTICS_EVENT_LIMIT*
[45] Fix | Delete
[46] Fix | Delete
This overrides the limit.
[47] Fix | Delete
[48] Fix | Delete
*WPMUDEV_ANALYTICS_TIME_WINDOW_SECONDS*
[49] Fix | Delete
[50] Fix | Delete
This overrides the time duration for which the site will be blocked from sending new events.
[51] Fix | Delete
[52] Fix | Delete
Let's say the following constants are defined:
[53] Fix | Delete
```
[54] Fix | Delete
define( 'WPMUDEV_ANALYTICS_TIME_WINDOW_SECONDS', 5 * 60 );
[55] Fix | Delete
define( 'WPMUDEV_ANALYTICS_EVENT_LIMIT', 3 );
[56] Fix | Delete
```
[57] Fix | Delete
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.
[58] Fix | Delete
[59] Fix | Delete
The site will not send any new events for the rest of the current 5-minute window.
[60] Fix | Delete
[61] Fix | Delete
In other words when the above constants are defined then this module ensures that 3 _or fewer_ events are generated every 5 minutes.
[62] Fix | Delete
[63] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function