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 ) {
$notification['title'] = __( 'Your Website Traffic Is Dropping', 'google-analytics-dashboard-for-wp' );
// 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 %sthis article%s to start growing your traffic again.', 'google-analytics-dashboard-for-wp' ), '', '' );
$notification['btns'] = array(
"learn_more" => array(
'url' => $this->build_external_link( 'https://www.exactmetrics.com/marketing-hacks-guaranteed-to-grow-your-traffic/' ),
'text' => __( 'Learn More', 'google-analytics-dashboard-for-wp' ),
'is_external' => true,
),
"view_report" => array(
'url' => $this->get_view_url( 'exactmetrics-report-overview', 'exactmetrics_reports' ),
'text' => __( 'View Report', 'google-analytics-dashboard-for-wp' )
),
);
return $notification;
}
return false;
}
}
// initialize the class
new ExactMetrics_Notification_Traffic_Dropping();