get_report(); if ( ! $report || ! $report['success'] ) { return false; } $sessions = isset( $report['data']['infobox']['sessions']['value'] ) ? $report['data']['infobox']['sessions']['value'] : 0; $all_countries = isset( $report['data']['countries'] ) ? $report['data']['countries'] : []; $eu_sessions = 0; foreach ( $all_countries as $country ) { if ( in_array( $country['iso'], $eu_countries ) ) { $eu_sessions += intval( $country['sessions'] ); } } if ( empty( $sessions ) ) { return false; } $eu_sessions_percentage = $eu_sessions / $sessions * 100; if ( $eu_sessions_percentage < 1 ) { return false; } $notification['title'] = __( 'Help Your Site Become GDPR Compliant', 'google-analytics-for-wordpress' ); $notification['content'] = __( 'Your site is receiving traffic from the EU. Help ensure your site is more compliant with GDPR by upgrading to MonsterInsights Pro and enable our EU Privacy addon.', 'google-analytics-for-wordpress' ); $notification['btns'] = array( "get_monsterinsights_pro" => array( 'url' => $this->get_upgrade_url(), 'text' => __( 'Get MonsterInsights Pro', 'google-analytics-for-wordpress' ), 'is_external' => true, ), ); return $notification; } } new MonsterInsights_Notification_Upgrade_EU_Traffic();