get_report();
$data['prev_sessions_difference'] = isset( $report['data']['infobox']['sessions']['prev'] ) ? $report['data']['infobox']['sessions']['prev'] : 0;
if ( ! empty( $data ) && $data['prev_sessions_difference'] < 0 ) {
$is_em = function_exists( 'ExactMetrics' );
$learn_more_url = $is_em
? 'https://www.exactmetrics.com/epic-list-of-marketing-hacks-for-explosive-traffic-growth/'
: 'https://www.monsterinsights.com/marketing-hacks-guaranteed-to-grow-your-traffic/';
$notification['title'] = __( 'Your Website Traffic is Dropping', 'google-analytics-for-wordpress' );
// Translators: Traffic dropping notification content
$notification['content'] = sprintf( __( 'Your website traffic is decreasing and that’s a reason to take action now. Less traffic means less opportunities to make your brand known, make relationships and ultimately sell your service or product.
Follow the marketing hacks of %1$sthis article%2$s to start growing your traffic again.', 'google-analytics-for-wordpress' ), '', '' );
$notification['btns'] = array(
'learn_more' => array(
'url' => $this->build_external_link( $learn_more_url ),
'text' => __( 'Learn More', 'google-analytics-for-wordpress' ),
'is_external' => true,
),
'view_report' => array(
'url' => $this->get_view_url( 'monsterinsights-report-overview', 'monsterinsights_reports' ),
'text' => __( 'View Report', 'google-analytics-for-wordpress' ),
),
);
return $notification;
}
return false;
}
}
// initialize the class
new MonsterInsights_Notification_Traffic_Dropping();