Forum Replies Created
-
AuthorPosts
-
February 2, 2014 at 4:02 am #9207
All set –
You just have to doc some widgets onto your front page – whichever ones you wish.
Also the dragonfly theme has some neat perks with it too… viewtopic.php?f=62&t=1127
Happy to have you! Just check in here when you need help.
February 2, 2014 at 3:42 am #9205Glad to have you! Since your site is still young, do you mind if I offer to upgrade you to the latest version? It appears your using 2.6.5 or so… (may I ask where you got it?)
If you can give me an admin account I can quickly convert you over and re-establish your menus and such, getting you up-to-par.
You can make the admin account for
name: leo
email: leo[at]symbiostock.comOtherwise you can download the latest version here https://github.com/orangeman555/symbiostock/blob/master/symbiostock.zip?raw=true
February 2, 2014 at 2:23 am #9172It went through —
000031 http://vector999.com 2014-02-01 19:18:21
February 2, 2014 at 1:59 am #9171Thats interesting – can you make me an admin account? I’ll see what the issue is if I have to fix it. I also have to do Christine’s site today too 😀
February 2, 2014 at 1:56 am #9190The best way is to go to:
APPEARANCE -> WIDGETS
There you will see widget docs:
- Footer 1/3
- Footer 2/3
- Footer 3/3
Basically you can put any widgets into those areas. For LINKS you could use TEXT WIDGET which would give you more control. Or you could install a cool footer widget which includes links.
February 2, 2014 at 1:20 am #9102Thank you much. I got bogged down yesterday and never got back to this 🙁
February 2, 2014 at 1:19 am #9193There is not time limit yet…once I slow down on other things I should be able to put in a time or download limit.
February 2, 2014 at 1:18 am #9184I have to reset my local github folder, but instead, simply paste this into the analytics file.
OPEN:
inc/class/analytics.php
Replace entire file:
<?php
/**
* Symbiostock's Analytics System. Tracks general visits and network referrals.
*
* This class tracks 4 page types: Image Views, Keyword Views, Keyword History, Category Views, and Human Searches.
* It also tracks referring URLs as well as Symbiostock-specific referrals (from the networks).
* It tracks general history back 60 days.
*
* To call analytics, you must add the proper variables to the URL:
*
* ss_analytics= (history|referrals|image_views|term_views)
* If getting traffic history ss_analytics=history, then you must specify the date range.
*
* Example General History:
* "?ss_analytics=history&ss_sdt=2014-01-28_21:05:37&ss_edt=2014-01-30_00:00:00" (mysql datetimes)
*
* Example, Keywords History:
* ?ss_analytics=keyword_history&ss_sdt=2014-01-27_06:48:45&ss_edt=2014-01-31_06:50:14
*
* (ss_sdt means Start Date, ss_edt means End Date).
*
* @link http://dev.mysql.com/doc/refman/4.1/en/datetime.html
*
* @category Symbiostock Analytics
* @package symbiostock
* @author Leo Blanchette
* @copyright Symbiostock
*/
class ss_analytics{
/**
* Whether or not to execute analytics log for given page. 1 = yes, 0 = no
* @var bool
*/
public $execute;
/**
* Client IP
* @var string
*/
public $client_ip;
/**
* Type of page: 1=image, 2=keyword, 3=category, 4=search
* @var int
*/
public $type;
/**
* ID of Image or Term
* @var int
*/
public $id;
/**
* User-entered search terms, when they are entering searches while browsing a Symbiostock site.
* @var string
*/
public $search_term;
/**
* If this is a symbiostock site referral, we log it.
* @var string
*/
public $referrer;
/**
* The URL of the general referrer, Symbiostock site or not.
* @var string url of referrer
*/
public $referring_url;
/**
* When the site delivers search results, this variable distinguishes between local, network, and promoted results.
* @var int 1: local 2: network 3: promoted
*/
public $search_result_type;
/**
* For local or network results, we list the website its coming from. This is used in keyword tracking.
* @var string the website results came from.
*/
public $results_website;
/**
* Set up initial class properties for analytics
*/
/**
* For tracking both keywords and tags as one.
* @var string
*/
public $keyword_or_tag;
public function __construct($action, $site = '', $result_type = '' ){
global $wpdb;
global $analytic_run_once;
$public_analytics = get_option('symbiostock_public_analytics', 1);
if($action == 1){
header('Content-type: text/plain');
if($public_analytics == 0){
echo 0;
die;
}
switch($_GET){
case 'history':
$this->history();
break;
case 'keyword_history':
$this->keyword_history();
break;
case 'referrals':
$this->referrals();
break;
case 'image_views':
$this->image_views();
break;
case 'term_views':
$this->term_views();
break;
}
die;
}
$theme_data = wp_get_theme( 'symbiostock' );
$last_version = get_option('ss_analytics_last_version', 0);
if($last_version version){
$installer = 1;
} else {
$installer = 0;
}
if($installer){
$ss_analytic_tables = array(
//ANALYTICS HISTORY
"CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."ss_analytics_history` (
`time` datetime NOT NULL,
`ip` varchar(128) NOT NULL,
`type` int(11) NOT NULL,
`id` int(11) NOT NULL,
`ss_referrer` varchar(2000) NOT NULL,
`r_url` varchar(2000) NOT NULL,
`search_term` varchar(128) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;",
//ANALYTICS KEYWORD PERFORMANCE
"CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."ss_analytics_keyword_performance` (
`time` datetime NOT NULL,
`site` varchar(2000) NOT NULL,
`keyword` varchar(100) NOT NULL,
`result_type` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;",
//IMAGE ANALYTICS
"CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."ss_analytics_image` (
`id` int(11) NOT NULL,
`lastview` datetime NOT NULL,
`views` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;",
//TERM ANALYTICS
"CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."ss_analytics_term` (
`id` int(11) NOT NULL,
`lastview` datetime NOT NULL,
`views` int(11) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;",
//REFERRAL ANALYTICS
"CREATE TABLE IF NOT EXISTS `".$wpdb->prefix."ss_analytics_referrals` (
`siteid` varchar(50) NOT NULL,
`referrals` int(11) NOT NULL,
PRIMARY KEY (`siteid`),
UNIQUE KEY `siteid` (`siteid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;",
);
foreach($ss_analytic_tables as $ss_analytic_table){
$wpdb->query($ss_analytic_table);
}
update_option('ss_analytics_last_version', $theme_data->version);
}
//set up IP address
$this->client_ip = $this->get_client_ip();
//if image, carry out image analytic functions
if ( 'image' == get_post_type() ){
//Since we are on valid page, we can issue an analytic logging
$this->execute = 1;
$this->type = 1;
$this->id = get_the_ID();
}
//if is keyword taxonomy, set up keyword analytic functions
if ( is_tax('image-tags') ){
//Since we are on valid page, we can issue an analytic logging
$this->execute = 1;
$this->type = 2;
$tag = get_query_var( 'image-tags' );
$obj = get_term_by( 'slug', $tag, 'image-tags', OBJECT);
$this->keyword_or_tag = $obj->name;
$this->id = $obj->term_id;
}
//if is category taxonomy, set up category analytic functions
if ( is_tax('image-type') ){
//Since we are on valid page, we can issue an analytic logging
$this->execute = 1;
$this->type = 3;
$category = get_query_var( 'image-type' );
$obj = get_term_by( 'slug', $category, 'image-type', OBJECT);
$this->id = $obj->term_id;
}
//if is search, set up search analytic functions
if ( is_search() ) {
//Since we are on valid page, we can issue an analytic logging
$this->execute = 1;
$this->type = 3;
$s = get_query_var( 's' );
$this->keyword_or_tag = $s;
$this->search_term = $s;
} else {
$this->search_term = 'NA';
}
//get Symbiostock Referrer (if from another site)
if(isset($_GET)){
if(!symbiostock_validate_url( $_GET ))
$this->referrer = 'NULL';
$this->referrer = $_GET;
} else {
$this->referrer = 'NULL';
}
if(isset($_SERVER)){
$this->referring_url = $_SERVER;
} else {
$this->referring_url = 'NULL';
}
if ((isset($_SERVER)) && ($_SERVER == 'prefetch')) {
// This is a prefetch request. stop it.
$this->execute = 0;
}
if($this->execute == 1){
$this->update_referrals();
switch($this->type){
case 1: #IMAGE
$this->update_history();
$this->update_image_analytic();
break;
case 2: #TAG
$this->update_history();
$this->update_term_analytic();
break;
case 3: #CATEGORY
$this->update_history();
$this->update_term_analytic();
break;
}
if($action == 2){
if(empty($site))
return;
$this->results_website = $site;
$this->search_result_type = $result_type;
$this->update_keyword_performance();
}
$this->delete_expired();
}
}
/**
* Logs a page visit to the analytics history.
*/
public function update_history(){
global $wpdb;
$results = $wpdb->insert(
$wpdb->prefix."ss_analytics_history",
array(
'time' => date('Y-m-d H:i:s'),
'ip' => mysql_real_escape_string($this->client_ip),
'type' => mysql_real_escape_string($this->type),
'id' => mysql_real_escape_string($this->id),
'ss_referrer' => mysql_real_escape_string($this->referrer),
'r_url' => mysql_real_escape_string($this->referring_url),
'search_term' => mysql_real_escape_string($this->search_term)
),
array(
'%s', // time
'%s', // ip
'%s', // type
'%s', // id
'%s', // ss_referrer
'%s', // r_url
'%s', // search_term
)
);
}
/**
* Updates image count
*/
function update_image_analytic(){
global $wpdb;
$wpdb->query(
"INSERT INTO `".$wpdb->prefix."ss_analytics_image`
(`id`, `lastview`, `views`)
VALUES
(".$this->id.", '".date('Y-m-d H:i:s')."', 1)
ON DUPLICATE KEY UPDATE
views = views + 1,
lastview = '".date('Y-m-d H:i:s')."'"
);
}
/**
* Updates term count
*/
function update_term_analytic(){
global $wpdb;
if(!isset($this->id) || empty($this->id))
return;
$wpdb->query(
"INSERT INTO `".$wpdb->prefix."ss_analytics_term`
(`id`, `lastview`, `views`)
VALUES
(".$this->id.", '".date('Y-m-d H:i:s')."', 1)
ON DUPLICATE KEY UPDATE
views = views + 1,
lastview = '".date('Y-m-d H:i:s')."'"
);
}
/**
* Updates keyword performance
*/
function update_keyword_performance(){
global $wpdb;
if(empty($this->keyword_or_tag) || empty($this->keyword_or_tag))
return;
$wpdb->query(
"INSERT INTO `".$wpdb->prefix."ss_analytics_keyword_performance`
(`time`, `site`, `keyword`, `result_type`)
VALUES
('".date('Y-m-d H:i:s')."', '".$this->results_website."', '".$this->keyword_or_tag."', ".$this->search_result_type.")"
);
}
/**
* Updates referral count
*/
function update_referrals(){
global $wpdb;
if(empty($this->referrer))
return;
$wpdb->query(
"INSERT INTO `".$wpdb->prefix."ss_analytics_referrals`
(`siteid`, `referrals`)
VALUES
('".mysql_real_escape_string($this->referrer)."', 1)
ON DUPLICATE KEY UPDATE
referrals = referrals + 1"
);
}
/**
* Deletes history over 60 days old
*/
public function delete_expired(){
$expiration = 60;
global $wpdb;
$wpdb->query("DELETE FROM ".$wpdb->prefix."ss_analytics_history
WHERE time < UNIX_TIMESTAMP(DATE_SUB(NOW(),
INTERVAL ".$expiration." DAY))");
$wpdb->query("DELETE FROM ".$wpdb->prefix."ss_analytics_keyword_performance
WHERE time < UNIX_TIMESTAMP(DATE_SUB(NOW(),
INTERVAL ".$expiration." DAY))");
}
/**
* Fairly reliable function for getting the IP address of visitor.
*
* @return string ip address
*/
public function get_client_ip() {
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if(getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if(getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if(getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if(getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if(getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'UNKNOWN';
return $ipaddress;
}
public function time_hint(){
return "Try: nn" . '&ss_std=' .
str_replace(' ', '_', date("Y-m-d H:i:s",strtotime(date("Y-m-d H:i:s"))-(60*60*24))) .
'&ss_edt=' . str_replace(' ', '_', date('Y-m-d H:i:s'))
."nn(Retrieves one day back from present server time)";
}
//---- ---- ---- Analytics Sharing ---- ---- ---- ----
public function generateCsv($data, $delimiter = ',', $enclosure = '"') {
$handle = fopen('php://temp', 'r+');
foreach ($data as $line) {
fputcsv($handle, $line, $delimiter, $enclosure);
}
rewind($handle);
while (!feof($handle)) {
$contents .= fread($handle, 8192);
}
fclose($handle);
return $contents;
}
/**
* Gets general history logs of visits.
*/
public function history(){
global $wpdb;
#date format: 2010-10-01
if(!isset($_GET)||!isset($_GET)){
echo "Request invalidn";
}
$start = mysql_real_escape_string(trim(str_replace('_', ' ', $_GET)));
$end = mysql_real_escape_string(trim(str_replace('_', ' ', $_GET)));
$history = $wpdb->get_results(
"SELECT *
FROM `".$wpdb->prefix."ss_analytics_history`
WHERE time
BETWEEN '".$start."' AND '".$end."'
ORDER BY time DESC", ARRAY_A
);
if(empty($history)){
echo "No results for given parametersnn";
echo $this->time_hint();
return;
}
$keys = array(
'TIME',
'IP',
'TYPE(1:image 2:keyword 3:category)',
'ID',
'SYMBIOSTOCK REFERRAL',
'REFERRING URL',
'SEARCH TERM (human entered)',
);
array_unshift($history, $keys);
echo $this->generateCsv($history);
}
/**
* Gets history of keyword results in general search (for keyword research)
*/
public function keyword_history(){
global $wpdb;
#date format: 2010-10-01
if(!isset($_GET)||!isset($_GET)){
echo "Request invalidn";
}
$start = mysql_real_escape_string(trim(str_replace('_', ' ', $_GET)));
$end = mysql_real_escape_string(trim(str_replace('_', ' ', $_GET)));
$history = $wpdb->get_results(
"SELECT *
FROM `".$wpdb->prefix."ss_analytics_keyword_performance`
WHERE time
BETWEEN '".$start."' AND '".$end."'
ORDER BY time DESC", ARRAY_A
);
if(empty($history)){
echo "No results for given parametersnn";
echo $this->time_hint();
return;
}
$keys = array(
'TIME',
'SITE',
'KEYWORD',
'RESULT TYPE (1: Local 2:Network 3:Promoted)',
);
array_unshift($history, $keys);
echo $this->generateCsv($history);
}
/**
* Gets the referral count of network sites.
*/
public function referrals(){
global $wpdb;
$referrals = $wpdb->get_results(
"SELECT *
FROM `".$wpdb->prefix."ss_analytics_referrals` ORDER BY referrals DESC", ARRAY_A
);
if(empty($referrals)){
echo 'No results';
return;
}
$keys = array(
'SITE',
'# REFERRALS'
);
array_unshift($referrals, $keys);
echo $this->generateCsv($referrals);
}
/**
* Gets image views.
*/
public function image_views(){
global $wpdb;
$imageviews = $wpdb->get_results(
"SELECT *
FROM `".$wpdb->prefix."ss_analytics_image` ORDER BY views DESC", ARRAY_A
);
if(empty($imageviews)){
echo 'No results';
return;
}
$keys = array(
'IMAGE ID',
'LAST VIEW',
'TOTAL VIEWS'
);
array_unshift($imageviews, $keys);
echo $this->generateCsv($imageviews);
}
/**
* Gets term views.
*/
public function term_views(){
global $wpdb;
$term_view_list = array();
$termviews = $wpdb->get_results(
"SELECT *
FROM `".$wpdb->prefix."ss_analytics_term` ORDER BY views DESC", ARRAY_A
);
if(empty($termviews)){
echo 'No results';
return;
}
foreach($termviews as $termview){
$obj = get_term_by( 'id', $termview, 'image-tags', ARRAY_A);
if($obj == NULL){
$obj = get_term_by( 'id', $termview, 'image-type', ARRAY_A);
}
array_push(
$term_view_list,
array(
$obj == 'image-type' ? 'keyword' : 'category',
$obj,
$obj,
$termview,
$termview
)
);
}
$keys = array(
'TAXONOMY',
'NAME',
'SLUG',
'LAST VIEW',
'TOTAL VIEWS'
);
array_unshift($term_view_list, $keys);
echo $this->generateCsv($term_view_list);
}
}
function ss_get_analytics(){
$analytics = new ss_analytics(0);
}
add_action('wp_head', 'ss_get_analytics');
function ss_share_analytics(){
if(isset($_GET)){
$analytics = new ss_analytics(1);
}
}
add_action('init', 'ss_share_analytics');
/**
* Prior function for logging keyword performance. No longer needed.
*
* @deprecated
* @param string $tag
*/
function symbiostock_keyword_update($tag = ''){
if( function_exists('get_terms_meta') && function_exists('update_terms_meta')){
$term = get_term_by( 'slug', $tag, 'image-tags', ARRAY_A );
if(is_array($term) && !empty($term)){
$n = get_terms_meta($term, 'views');
if(!isset($n[0]) || empty($n[0])){
update_terms_meta($term, 'views', 1);
} else {
$n[0]++;
update_terms_meta($term, 'views', $n[0]);
}
//write log file
if(isset($_GET)){
$r = str_replace('http://', '', $_GET);
} else {
$r = 0;
}
if($_SERVER == $_SERVER){
$type = 1;
} else {
$type = 2;
}
$info = array(
$tag, //keyword
$type, // 1 = local, 2 = remote
$r, // referrer (humans only)
$_SERVER, //remote referring IP
current_time( 'mysql', 1 ), //IMPORTANT gives GMT time
);
$name = ABSPATH . '/symbiostock_search_log.csv';
//if its the first of the month, delete file
if(date('d') == 1){
if(file_exists($name)){
unlink($name);
}
}
if(file_exists($name)){
$linecount = 0;
$handle = fopen($name, "r");
while(!feof($handle)){
$line = fgets($handle);
$linecount++;
}
if($linecount > 5000){
unlink($name);
}
}
file_put_contents($name, implode(',', $info).PHP_EOL, FILE_APPEND);
}
}
}February 2, 2014 at 12:50 am #9182Upgrade now you should be fine.
February 2, 2014 at 12:44 am #9181Thanks. I’ll get on that Asap.
February 2, 2014 at 12:05 am #9169Hi there! Thanks a lot.
Heres an update:
000001 http://www.clipartillustration.com
000003 http://localhost/symbiostock
000004 http://7horses.eu/wp
000005 http://thpstockphotos.com
000006 http://crystalmoo.lunament.com
000007 http://www.flashstockphoto.com
000008 http://selectstockpix.com
000009 http://ajotte.com
000010 http://vectorillustrationshop.com
000011 http://stock.ariene.eu
000012 http://katstock.net
000013 http://innerstock.com
000014 http://atlanticastockphoto.com
000015 http://ruthblackphotography.com
000016 http://eggheadstock.com
000017 http://softlightstock.com
000018 http://quailrunphoto.com
000019 http://www.catchthelight.co.uk
000020 http://stockphotosart.com
000021 http://localhost/wp
000022 http://www.imagoborealis.com
000023 http://stock.tdahlphotography.com
000024 http://wesellimages.com
000025 http://kerioakimaging.com
000026 http://apduff.com/stock
000027 http://www.teamclipart.com
000028 http://www.arquivoscriativos.com.br
000029 http://stock.kelleherphoto.com
000030 http://fantasticstock.com
February 1, 2014 at 9:30 pm #9166@lucato wrote:
Just did it. ;0)
Hi lucato! Since your here I just wanted to let you know:
A: Your on my network (I have to add a few more people)
B: I’ll be getting back to the translation after I fix a few major overhauls (like the .com needing to be finished again)February 1, 2014 at 7:57 am #9135PS what is your site?
February 1, 2014 at 7:56 am #9134Hi there, I don’t know how I almost missed this.
You simply have to announce your site and it will be added. We’re working on a more automated process right now, but for now thats how it happens.
February 1, 2014 at 7:28 am #9160@thp wrote:
@leo wrote:
Here you go:
000001 http://www.clipartillustration.com 2014-01-31 22:48:45
000003 http://localhost/symbiostock 2014-01-30 21:06:40
000004 http://7horses.eu/wp 2014-01-31 03:22:06
000005 http://thpstockphotos.com 2014-01-31 23:55:37
Oooh interesting! Now just need to find out who that number 2 is…
I wonder in years to come if the original symbiostock id’s will be highly prized. Like when you talk about Shutterstock or something and someone busts out the “well I’m user number 157!”.
Maybe I can list my number 5 site on eBay or something and sell it for millions…Hmm, so many possibilities… 😆
You should launch 6 or 7 dummy sites right now! Thats not a bad idea.
-
AuthorPosts