$end_date = $ed_date;
}
// Fetch Dashboard Profile ID.
$dashboard_profile_id = get_option('pt_webprofile_dashboard');
?>
<div class="wrap">
	<h2 class='opt-title'><span id='icon-options-general' class='analytics-options'><img src="<?php 
echo esc_url(plugins_url('images/wp-analytics-logo.png', dirname(__FILE__)));
?>
" alt=""></span>
		<?php 
esc_html_e('Analytify Dashboard', 'wp-analytify');
?>
    </h2>
	<?php 
if (wpa_check_profile_selection('Analytify')) {
    return;
}
$access_token = get_option('post_analytics_token');
if ($access_token) {
    ?>
    <div id="col-container">
        <div class="metabox-holder">
            <div class="postbox" style="width:100%;">
                    <div id="main-sortables" class="meta-box-sortables ui-sortable">
                        <div class="postbox ">
                            <div class="handlediv" title="Click to toggle"><br />
                            </div>
                            <h3 class="hndle">
                                <span>
								<?php 
 public function get_single_admin_analytics($start_date = '', $end_date = '', $postID = 0, $ajax = 0)
 {
     global $post;
     if (wpa_check_profile_selection('Analytify', '<br /><b class="wpa_notice_error">Select your website profile at Analytify->settings->profile tab to load stats.</b>')) {
         return;
     }
     if ($postID == 0) {
         $u_post = '/';
         // $urlPost['path'];
     } else {
         $u_post = parse_url(get_permalink($postID));
     }
     if ($u_post['host'] == 'localhost') {
         $filter = false;
     } else {
         $filter = 'ga:pagePath==' . $u_post['path'] . '';
     }
     if ($start_date == '') {
         $s_date = get_the_time('Y-m-d', $post->ID);
         if (get_the_time('Y', $post->ID) < 2005) {
             $s_date = '2005-01-01';
         }
     } else {
         $s_date = $start_date;
     }
     if ($end_date == '') {
         $e_date = date('Y-m-d');
     } else {
         $e_date = $end_date;
     }
     $show_settings = array();
     $show_settings = get_option('post_analytics_settings_back');
     // Stop here, if user has disable backend analytics i.e OFF
     if (get_option('post_analytics_disable_back') == 1 and $ajax == 0) {
         return;
     }
     echo '<p> Displaying Analytics of this page from ' . date('jS F, Y', strtotime($s_date)) . ' to ' . date('jS F, Y', strtotime($e_date)) . '</p>';
     if (!empty($show_settings)) {
         if (is_array($show_settings)) {
             if (in_array('show-overall-back', $show_settings)) {
                 $stats = $this->pa_get_analytics('ga:sessions,ga:bounces,ga:newUsers,ga:entrances,ga:pageviews,ga:sessionDuration,ga:avgTimeOnPage,ga:users', $s_date, $e_date, false, false, $filter);
                 if (isset($stats->totalsForAllResults)) {
                     include ANALYTIFY_ROOT_PATH . '/views/admin/single-general-stats.php';
                     wpa_single_include_general($this, $stats);
                 }
             }
         }
     }
 }