@@ -209,6 +209,15 @@ public function option_notice() {
209209return ;
210210}
211211
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+
212221foreach ( $ this ->entities as $ key => $ data ) {
213222
214223$ time_to_display = isset ( $ data ['time_to_display ' ] ) ? $ data ['time_to_display ' ] : '+24 hours ' ;
@@ -225,8 +234,13 @@ public function option_notice() {
225234}
226235
227236/* 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+
230244if ( is_multisite () ) {
231245$ notice_string .= __ ( 'This will be applicable for all sites from the network. ' );
232246}
@@ -252,7 +266,7 @@ public function option_notice() {
252266</div>
253267</div> ' ,
254268/* 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. ' ) ),
256270esc_url (
257271add_query_arg (
258272array (
@@ -281,6 +295,8 @@ public function option_notice() {
281295'display-with-other-notices ' => true ,
282296)
283297);
298+
299+ return ;
284300}
285301}
286302
@@ -344,6 +360,7 @@ private function optin( $source ) {
344360 */
345361private function optout ( $ source ) {
346362update_site_option ( $ source . '_analytics_optin ' , 'no ' );
363+ update_site_option ( 'bsf_analytics_last_displayed_time ' , time () );
347364}
348365
349366/**
@@ -357,6 +374,7 @@ private function includes() {
357374
358375// Loads all the modules.
359376require_once __DIR__ . '/modules/deactivation-survey/classes/class-deactivation-survey-feedback.php ' ;
377+ require_once __DIR__ . '/modules/utm-analytics.php ' ;
360378}
361379
362380/**
@@ -372,6 +390,17 @@ public function register_usage_tracking_setting() {
372390return ;
373391}
374392
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+
375404$ usage_doc_link = isset ( $ data ['usage_doc_link ' ] ) ? $ data ['usage_doc_link ' ] : $ this ->usage_doc_link ;
376405$ author = isset ( $ data ['author ' ] ) ? $ data ['author ' ] : 'Brainstorm Force ' ;
377406
@@ -488,7 +517,7 @@ public function add_analytics_option_callback( $option, $value ) {
488517}
489518
490519/**
491- * Send analaytics track event if tracking is enabled.
520+ * Send analytics track event if tracking is enabled.
492521 *
493522 * @since 1.0.0
494523 */
@@ -540,7 +569,7 @@ public function load_deactivation_survey_form() {
540569
541570if ( class_exists ( 'Deactivation_Survey_Feedback ' ) ) {
542571foreach ( $ 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.
544573if ( ! empty ( $ data ['deactivation_survey ' ] ) && is_array ( $ data ['deactivation_survey ' ] ) ) {
545574foreach ( $ data ['deactivation_survey ' ] as $ key => $ survey_args ) {
546575Deactivation_Survey_Feedback::show_feedback_form (
0 commit comments