@@ -209,6 +209,15 @@ public function option_notice() {
209
209
return ;
210
210
}
211
211
212
+ if ( $ this ->is_tracking_enabled () ) {
213
+ return ; // Don't need to display notice if any of our plugin already have the permission.
214
+ }
215
+
216
+ // If the user has opted out of tracking, don't show the notice till 7 days.
217
+ if ( get_site_option ( 'bsf_analytics_last_displayed_time ' ) > time () - ( 7 * DAY_IN_SECONDS ) ) {
218
+ return ; // Don't display the notice if it was displayed recently.
219
+ }
220
+
212
221
foreach ( $ this ->entities as $ key => $ data ) {
213
222
214
223
$ time_to_display = isset ( $ data ['time_to_display ' ] ) ? $ data ['time_to_display ' ] : '+24 hours ' ;
@@ -225,8 +234,13 @@ public function option_notice() {
225
234
}
226
235
227
236
/* translators: %s product name */
228
- $ notice_string = sprintf ( __ ( 'Want to help make %1s even more awesome? Allow us to collect non-sensitive diagnostic data and usage information. ' ), '<strong> ' . esc_html ( $ data ['product_name ' ] ) . '</strong> ' );
229
-
237
+ $ notice_string = sprintf (
238
+ __ (
239
+ 'Help us improve %1$s and our other products!<br><br>With your permission, we \'d like to collect <strong>non-sensitive information</strong> from your website — like your PHP version and which features you use — so we can fix bugs faster, make smarter decisions, and build features that actually matter to you. <em>No personal info. Ever.</em> '
240
+ ),
241
+ '<strong> ' . esc_html ( $ data ['product_name ' ] ) . '</strong> '
242
+ );
243
+
230
244
if ( is_multisite () ) {
231
245
$ notice_string .= __ ( 'This will be applicable for all sites from the network. ' );
232
246
}
@@ -252,7 +266,7 @@ public function option_notice() {
252
266
</div>
253
267
</div> ' ,
254
268
/* translators: %s usage doc link */
255
- sprintf ( $ notice_string . '<span dir="%1s"><a href="%2s" target="_blank" rel="noreferrer noopener">%3s</a><span> ' , $ language_dir , esc_url ( $ usage_doc_link ), __ ( ' Know More. ' ) ),
269
+ sprintf ( $ notice_string . '<span dir="%1s"><a href="%2s" target="_blank" rel="noreferrer noopener">%3s</a><span><br><br> ' , $ language_dir , esc_url ( $ usage_doc_link ), __ ( ' Know More. ' ) ),
256
270
esc_url (
257
271
add_query_arg (
258
272
array (
@@ -281,6 +295,8 @@ public function option_notice() {
281
295
'display-with-other-notices ' => true ,
282
296
)
283
297
);
298
+
299
+ return ;
284
300
}
285
301
}
286
302
@@ -344,6 +360,7 @@ private function optin( $source ) {
344
360
*/
345
361
private function optout ( $ source ) {
346
362
update_site_option ( $ source . '_analytics_optin ' , 'no ' );
363
+ update_site_option ( 'bsf_analytics_last_displayed_time ' , time () );
347
364
}
348
365
349
366
/**
@@ -357,6 +374,7 @@ private function includes() {
357
374
358
375
// Loads all the modules.
359
376
require_once __DIR__ . '/modules/deactivation-survey/classes/class-deactivation-survey-feedback.php ' ;
377
+ require_once __DIR__ . '/modules/utm-analytics.php ' ;
360
378
}
361
379
362
380
/**
@@ -372,6 +390,17 @@ public function register_usage_tracking_setting() {
372
390
return ;
373
391
}
374
392
393
+ /**
394
+ * Introducing a new key 'hide_optin_checkbox, which allows individual plugin to hide optin checkbox
395
+ * If they are providing providing in-plugin option to manage this option.
396
+ * from General > Settings page.
397
+ *
398
+ * @since 1.1.14
399
+ */
400
+ if ( ! empty ( $ data ['hide_optin_checkbox ' ] ) && true === $ data ['hide_optin_checkbox ' ] ) {
401
+ continue ;
402
+ }
403
+
375
404
$ usage_doc_link = isset ( $ data ['usage_doc_link ' ] ) ? $ data ['usage_doc_link ' ] : $ this ->usage_doc_link ;
376
405
$ author = isset ( $ data ['author ' ] ) ? $ data ['author ' ] : 'Brainstorm Force ' ;
377
406
@@ -488,7 +517,7 @@ public function add_analytics_option_callback( $option, $value ) {
488
517
}
489
518
490
519
/**
491
- * Send analaytics track event if tracking is enabled.
520
+ * Send analytics track event if tracking is enabled.
492
521
*
493
522
* @since 1.0.0
494
523
*/
@@ -540,7 +569,7 @@ public function load_deactivation_survey_form() {
540
569
541
570
if ( class_exists ( 'Deactivation_Survey_Feedback ' ) ) {
542
571
foreach ( $ this ->entities as $ key => $ data ) {
543
- // If the deactibation_survery info in available then only add the form.
572
+ // If the deactivation_survey info in available then only add the form.
544
573
if ( ! empty ( $ data ['deactivation_survey ' ] ) && is_array ( $ data ['deactivation_survey ' ] ) ) {
545
574
foreach ( $ data ['deactivation_survey ' ] as $ key => $ survey_args ) {
546
575
Deactivation_Survey_Feedback::show_feedback_form (
0 commit comments