ID.";\n"; $roles = $current_user->roles; $role = array_shift( $roles ); if (!empty($role)) $code .="vdata.role='$role';\n"; if (!empty($current_user->user_login)) $code .="vdata.username='".$current_user->user_login."';\n"; if (!empty($current_user->user_email)) $code .="vdata.email='".$current_user->user_email."';\n"; if (!empty($current_user->user_firstname)) $code .="vdata.firstname='".$current_user->user_firstname."';\n"; if (!empty($current_user->user_lastname))$code .="vdata.lastname='".$current_user->user_lastname."';\n"; if (!empty($current_user->display_name)) $code .="vdata.displayedname='".$current_user->display_name."';\n"; $code.="var ol= Object.keys(vdata).length;\n"; //$code.="console.log('vdata->',ol);\n"; $code.="if (ol>2){\n"; $code .="aa('set','visitor',vdata);\n"; $code .="aa('send','visitor');\n"; $code.="var d = new Date();\n"; $code.="d.setTime(d.getTime() +((3600*12)*1000));\n"; $code.="var expires = 'expires='+ d.toUTCString();\n"; $code.="document.cookie = 'afssetuser=1;'+expires+';path=/';\n"; $code.="}\n"; } } return($code); } function admin_tracking() { $admin_pages_tracking= get_option("afs_admin_pages_tracking"); if ( $admin_pages_tracking==1) $this->wp_footer(); } function wp_footer() { //echo stripcslashes(get_option('afs_code')); $afs_account = stripcslashes(get_option('afs_account')); $afs_server = ""; if ($afs_account > 99999) $afs_server = '1'; if ($afs_account > 199999) $afs_server = '2'; if ($afs_account > 299999) $afs_server = '3'; if ($afs_account > 399999) $afs_server = '4'; if ($afs_account > 499999) $afs_server = '5'; if ($afs_account > 599999) $afs_server = '6'; if ($afs_account > 699999) $afs_server = '7'; if ($afs_account > 799999) $afs_server = '8'; if ($afs_account > 899999) $afs_server = '9'; if ($afs_account > 999999) $afs_server = '10'; global $post; $postID = get_the_ID(); $trackerflag=0; if (!isset($trackername)) { $flagid=0; if (is_home()) { $trackername = get_bloginfo('name'); $trackerflag=1; } else { if (is_attachment ($postID)==false && is_page ($postID)==false && is_single ($postID)==false) { $trackerflag=0; } else { if (isset($post->ID)) { $postID = $post->ID; $trackername = get_post_meta($postID, "afstrackername", true); if (empty($trackername)) $trackername = $post->post_title;} $trackerflag=1; } } } if (empty($trackername)) $trackerflag=0; if ( $trackerflag==1) { $trackername = stripslashes($trackername); if (strpos($trackername, '|') !== FALSE) $trackername = strstr($trackername, '|'); $trackername = addslashes($trackername); $trackername = trim($trackername); } $autotrack_all= intval(get_option('afs_autotrack_all')); $autotrack_outbound= intval(get_option('afs_autotrack_outbound')); $autotrack_inside= intval(get_option('afs_autotrack_inside')); $autotrack_download= intval(get_option('afs_autotrack_download')); $autotrack_video= intval(get_option('afs_autotrack_video')); $autotrack_iframe= intval(get_option('afs_autotrack_iframe')); $user_logged_tracking= intval(get_option('afs_user_logged_tracking')); $afs_code ="\n"; $afs_code .="\n"; $afs_code .="\n"; print $afs_code; } function account_ok($account) { if (empty($account) || intval($account)==0) { print "
"; print "

"; _e('You have to define the plugin settings!','afs'); print "

"; print "
"; print "\n\n"; return(-1); } return(0); } function build_redirectionpage( $text, $url) { $account = get_option('afs_account'); if ($this->account_ok($account)==-1) return; $accesskey= get_option('afs_accesskey'); $faccess=0; print "
"; print "

"; _e('Please be patient, AFS Analytics is loading ...','afs'); print "

"; print "
"; print "

"; if (empty($accesskey)==true || $accesskey=="none" || $accesskey=="NULL" || $accesskey=="null" || $accesskey=="NONE") { print "$text"; } else { print "$text"; $faccess=1; } print "

"; print "\n\n"; } function redirect_afs() { $this->build_redirectionpage("AFS Analytics dashboard","dashboard.php"); } function afs_rightnow() { $this->build_redirectionpage("Right Now","rightnow.php"); } function afs_lastvisitors() { $this->build_redirectionpage("Last Visitors","lastvisitors.php"); } function afs_heatmaps() { $this->build_redirectionpage("Heatmaps","heatmaps.php"); } function afs_keywordchecker() { $this->build_redirectionpage("keyword position checker","keywords_monitoring.php"); } function afs_pdf() { $this->build_redirectionpage("PDF Reports","edpdf.php"); } function afs_go($url) { print "
"; print "

"; _e('Please be patient, AFS Analytics is loading ...','afs'); print "

"; print "
"; print "\n\n"; } function afs_keys() { $this->afs_go("https://www.afsanalytics.com/accesskeys.php"); } function afs_profile() { $this->afs_go("https://www.afsanalytics.com/edprofile.php"); } function afs_options() { $this->afs_go("https://www.afsanalytics.com/edaccounts.php"); } function afs_password() { $this->afs_go("https://www.afsanalytics.com?lostpass=1"); } function afs_upgrade() { $this->afs_go("https://www.afsanalytics.com/pricing.php"); } function afs_help() { $this->afs_go("https://www.afsanalytics.com/articles/web-statistics-reports/"); } function afs_contact() { $this->afs_go("https://www.afsanalytics.com/contact.html"); } function add_trackerfield() { global $post; $postID = get_the_ID(); if ($postID!=false) { $trackername = stripslashes(get_post_meta($postID, "afstrackername", true)); print "
"; print ""; _e('AFS Analytics tracker name','afs'); //print ":  $postID"; print ": "; print ""; print "
"; } } function save_trackerfield() { global $post; $postID=get_the_ID(); if ($postID!=false) { if (isset($_POST['afstrackername'])) $tracker = addslashes($_POST['afstrackername']); else $tracker = addslashes($_POST['post_title']); if (empty($tracker)) $tracker = $post->post_title; if (!empty($tracker)) { if (!add_post_meta($postID, 'afstrackername', $tracker, true)) { update_post_meta($postID, 'afstrackername', $tracker); } } } } function plugin_menu() { $message = null; $message_updated = __("Data Saved!","afs"); $message_empty = __("Error: AFS website ID number must be a 8 digits! ","afs"); // update options if (!empty($_POST)) { if ($_POST['afs_account']) { $accountstr=$_POST['afs_account']; $accountstr=trim($accountstr); if (strcasecmp($accountstr,"NULL")==0) update_option('afs_account',""); else { $num=intval($accountstr); if ($num==0) $message = $message_empty; else { $accountstr=sprintf("%08d",$num); update_option('afs_account',$accountstr); $message = $message_updated; } } } if ($_POST['afs_accesskey']) { $accesskey=$_POST['afs_accesskey']; $accesskey=trim($accesskey); if (strcasecmp($accountstr,"NULL")==0) update_option('afs_accesskey',""); else update_option('afs_accesskey', $accesskey); } if (isset($_POST['admin_pages_tracking'])) update_option( 'afs_admin_pages_tracking',$_POST['admin_pages_tracking']); if (isset($_POST['user_logged_tracking'])) update_option( 'afs_user_logged_tracking',$_POST['user_logged_tracking']); if (isset($_POST['autotrack_all'])) update_option('afs_autotrack_all',$_POST['autotrack_all']); if (isset($_POST['autotrack_outbound'])) update_option('afs_autotrack_outbound',$_POST['autotrack_outbound']); if (isset($_POST['autotrack_inside'])) update_option('afs_autotrack_inside',$_POST['autotrack_inside']); if (isset($_POST['autotrack_download'])) update_option('afs_autotrack_download',$_POST['autotrack_download']); if (isset($_POST['autotrack_video'])) update_option('afs_autotrack_video',$_POST['autotrack_video']); if (isset($_POST['autotrack_iframe'])) update_option('afs_autotrack_iframe',$_POST['autotrack_iframe']); wp_cache_flush(); } /* else { $message = $message_empty; //update_option('afs_account', ""); wp_cache_flush(); } */ ?>

\n"; ?>

"; _e('Click here','afs'); print " "; _e('to get a Website ID','afs'); print "
"; _e('2 - Type your Website ID into the Website ID field','afs'); print ".
"; _e("3 - Click on 'Update' button","afs"); print ".
"; _e('4 - AFS Analytics code will be inserted into the header','afs'); print ".
"; ?>

AFS Analytics Settings

Reset
AutoTrack (general settings)','afs');?>   
Outbound clicks tracking  
Inside clicks tracking  
Download tracking  
Video tracking  
iframe tracking  
Admin pages tracking  
User logged tracking  
Access Key(optional):','afs');?> Reset

"; _e('visible tracker','afs'); print ". "; _e('If you selected a visible tracker, you can specify exactly its location. You do this by adding this line:','afs'); print '<div id="afsanalytics"></div> '; _e('where you want it to show up.','afs'); */ ?>

Contact-us','afs');?>    AFS Analytics','afs');?>    DataSense','afs');?>