@@ -14,7 +14,7 @@ composer require bitapps/wp-telemetry
1414
1515### 2. Create a Telemetry Client
1616
17- Initialize the telemetry client in your plugin.
17+ Initialize the telemetry client in your plugin's bootstrap file .
1818
1919``` php
2020function initialize_telemetry_client() {
@@ -24,6 +24,9 @@ function initialize_telemetry_client() {
2424 TelemetryConfig::setVersion($version);
2525 TelemetryConfig::setServerBaseUrl( 'https://api.example.com/' );
2626
27+ TelemetryConfig::setTermsUrl( 'https://example.com/terms' ); // optional
28+ TelemetryConfig::setPolicyUrl( 'https://example.com/privacy' ); // optional
29+
2730 // initialize tracking and reporting
2831 Telemetry::report()->init();
2932
@@ -40,20 +43,6 @@ You are good to go! The telemetry client will start sending data to the default
4043
4144All the configuration should be done in the ` initialize_telemetry_client() ` function.
4245
43- ### # Telemetry Client Config
44-
45- Set custom terms URL
46-
47- ``` php
48- TelemetryConfig::setTermsUrl( 'https://example.com/terms' );
49- ```
50-
51- Set custom privacy policy URL
52-
53- ``` php
54- TelemetryConfig::setPolicyUrl( 'https://example.com/privacy' );
55- ```
56-
5746### # Tracking Report Modify
5847
5948Add plugin information in tracking data
@@ -64,12 +53,14 @@ TelemetryConfig::report()
6453 ->init();
6554```
6655
67- Add additional data in tracking data
56+ ** Filter Hook to Add Additional Data :**
57+
58+ This filter allows adding additional data to track information used by the plugin. You can modify the ` additional_data ` array to include any custom data needed.
6859
6960``` php
7061$plugin_prefix = 'my_plugin_prefix_';
7162
72- add_filter($plugin_prefix . 'tracking_additional_data ', function($additional_data) {
63+ add_filter($plugin_prefix . 'telemetry_additional_data ', function($additional_data) {
7364
7465 // example: add custom data
7566 $additional_data['my_custom_data'] = 'My Custom Data';
@@ -78,17 +69,22 @@ add_filter($plugin_prefix . 'tracking_additional_data', function($additional_dat
7869});
7970```
8071
81- Filter tracking data before sending
72+ ** Filter Hook To Modify Telemetry Data :**
73+
74+ This filter allows modification of the telemetry data array before it is sent.
8275
8376``` php
8477$plugin_prefix = 'my_plugin_prefix_';
8578
86- add_filter($plugin_prefix . 'tracking_data ', function($tracking_data ) {
79+ add_filter($plugin_prefix . 'telemetry_data ', function($telemetry_data ) {
8780
8881 // example: remove some data
89- unset($tracking_data['some_data']);
82+ unset($telemetry_data['some_data']);
83+
84+ // example: add custom data
85+ $telemetry_data['my_custom_data'] = 'My Custom Data';
9086
91- return $tracking_data ;
87+ return $telemetry_data ;
9288});
9389```
9490
0 commit comments