Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0359e12555 | ||
|
|
83e17cec7c | ||
|
|
05e4c00b7f | ||
|
|
69eb59b93b | ||
|
|
4883c53419 |
@@ -61,7 +61,7 @@ class BannerHelper {
|
|||||||
|
|
||||||
|
|
||||||
private static function getBannerImpressions($bannerIds) {
|
private static function getBannerImpressions($bannerIds) {
|
||||||
$time = strtotime("today CET");
|
$time = strtotime("today");
|
||||||
$stats = GlobalVariables::get("dao")->query(
|
$stats = GlobalVariables::get("dao")->query(
|
||||||
BannerStatsModel::class,
|
BannerStatsModel::class,
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class PipelineHelper {
|
|||||||
'statType'=>StatisticModel::STAT_TYPE_BANNER_IMPRESSION,
|
'statType'=>StatisticModel::STAT_TYPE_BANNER_IMPRESSION,
|
||||||
'content.position'=>$position,
|
'content.position'=>$position,
|
||||||
// 'date'=>array( '$gte'=>new MongoDate(strtotime("today")) )
|
// 'date'=>array( '$gte'=>new MongoDate(strtotime("today")) )
|
||||||
'date'=>array( '$gte'=>new MongoDB\BSON\UTCDateTime(strtotime("today CET") * 1000) )
|
'date'=>array( '$gte'=>new MongoDB\BSON\UTCDateTime(strtotime("today") * 1000) )
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ArticleStatsModel extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getFilter($articleId, $day, $month, $year) {
|
public static function getFilter($articleId, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
return [
|
return [
|
||||||
'notizia' => $articleId,
|
'notizia' => $articleId,
|
||||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class BannerStatsModel extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function new($bannerId, $day, $month, $year) {
|
public static function new($bannerId, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
return new static(
|
return new static(
|
||||||
(object)[
|
(object)[
|
||||||
'banner' => $bannerId,
|
'banner' => $bannerId,
|
||||||
@@ -30,7 +30,7 @@ class BannerStatsModel extends Model {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
public static function getFilter($bannerId, $day, $month, $year) {
|
public static function getFilter($bannerId, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
return [
|
return [
|
||||||
'banner' => $bannerId,
|
'banner' => $bannerId,
|
||||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ class PageViewStatsModel extends Model {
|
|||||||
return "pageview_stats";
|
return "pageview_stats";
|
||||||
}
|
}
|
||||||
public static function new($page, $day, $month, $year) {
|
public static function new($page, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
|
|
||||||
return new static(
|
return new static(
|
||||||
(object)[
|
(object)[
|
||||||
@@ -33,7 +33,7 @@ class PageViewStatsModel extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static function getFilter($page, $day, $month, $year) {
|
public static function getFilter($page, $day, $month, $year) {
|
||||||
$time = strtotime("$year-$month-$day CET");
|
$time = strtotime("$year-$month-$day");
|
||||||
return [
|
return [
|
||||||
'page' => $page,
|
'page' => $page,
|
||||||
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
'time' => new MongoDB\BSON\UTCDateTime( $time * 1000 ),
|
||||||
|
|||||||
@@ -381,7 +381,7 @@ class GUIHandler {
|
|||||||
|
|
||||||
$stats = GlobalVariables::get("dao")->aggregate(
|
$stats = GlobalVariables::get("dao")->aggregate(
|
||||||
ArticleStatsModel::class,
|
ArticleStatsModel::class,
|
||||||
PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days CET"),5)
|
PipelineHelper::getMostViewedOfLastDays(strtotime("-7 days"),5)
|
||||||
);
|
);
|
||||||
$idArray = array_map(function ($ele){ return new MongoDB\BSON\ObjectID($ele["notizia"]);}, $stats);
|
$idArray = array_map(function ($ele){ return new MongoDB\BSON\ObjectID($ele["notizia"]);}, $stats);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ Author: Riccardo Di Dato
|
|||||||
Creation Date: 04/feb/2013
|
Creation Date: 04/feb/2013
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
date_default_timezone_set("Europe/Rome");
|
||||||
|
|
||||||
require_once(dirname(__FILE__)."/common/config.php");
|
require_once(dirname(__FILE__)."/common/config.php");
|
||||||
|
|
||||||
require_once(dirname(__FILE__)."/lib/lib.inclusions.php");
|
require_once(dirname(__FILE__)."/lib/lib.inclusions.php");
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ try{
|
|||||||
<div class="bannerStat">
|
<div class="bannerStat">
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Oggi</div>
|
<div class="statName">Oggi</div>
|
||||||
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("today CET"));?></div>
|
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("today"));?></div>
|
||||||
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("today CET"));?></div>
|
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("today"));?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Ultima settimana</div>
|
<div class="statName">Ultima settimana</div>
|
||||||
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("-7 days CET"));?></div>
|
<div>Visualizzazioni: <?php echo AnalyticsHelper::countBannerImpressions($banner->id,strtotime("-7 days"));?></div>
|
||||||
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("-7 days CET"));?></div>
|
<div class="toHide">Click: <?php echo AnalyticsHelper::countBannerClicks($banner->id,strtotime("-7 days"));?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Totali</div>
|
<div class="statName">Totali</div>
|
||||||
|
|||||||
@@ -144,11 +144,11 @@ try{
|
|||||||
<div class="notiziaStat">
|
<div class="notiziaStat">
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Oggi</div>
|
<div class="statName">Oggi</div>
|
||||||
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("today CET"));?></div>
|
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("today"));?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Ultima settimana</div>
|
<div class="statName">Ultima settimana</div>
|
||||||
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("-7 days CET"));?></div>
|
<div><?php echo AnalyticsHelper::countNotiziaImpressions($notizia->id,strtotime("-7 days"));?></div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="statName">Totali</div>
|
<div class="statName">Totali</div>
|
||||||
|
|||||||
+23
-1
@@ -41,7 +41,29 @@ function bannerGroup(group, grpName) {
|
|||||||
(target) => {
|
(target) => {
|
||||||
if (rval.length > 0) {
|
if (rval.length > 0) {
|
||||||
const ele = rval.shift();
|
const ele = rval.shift();
|
||||||
$('#'+target).html(ele.media);
|
let mediaHtml = ele.media;
|
||||||
|
if (ele.link) {
|
||||||
|
const a = document.createElement('a');
|
||||||
|
a.href = ele.link;
|
||||||
|
a.target = "_blank";
|
||||||
|
a.innerHTML = ele.media;
|
||||||
|
mediaHtml = a;
|
||||||
|
}
|
||||||
|
mediaHtml.addEventListener(
|
||||||
|
'click',
|
||||||
|
() => {
|
||||||
|
$.ajax({
|
||||||
|
url: "stats/bannerClick.php",
|
||||||
|
method: "POST",
|
||||||
|
data: {
|
||||||
|
banner: ele.id,
|
||||||
|
source: document.URL
|
||||||
|
},
|
||||||
|
dataType: "html"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
$('#'+target).html(mediaHtml);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ try {
|
|||||||
|
|
||||||
if (!is_null($ip) && !is_null($banners) && !is_null($source)){
|
if (!is_null($ip) && !is_null($banners) && !is_null($source)){
|
||||||
$banners = explode(",", $banners);
|
$banners = explode(",", $banners);
|
||||||
$ts = strtotime('today CET');
|
$ts = strtotime('today');
|
||||||
|
|
||||||
foreach ($banners as $banner) {
|
foreach ($banners as $banner) {
|
||||||
AnalyticsHelper::bannerImpression(
|
AnalyticsHelper::bannerImpression(
|
||||||
|
|||||||
Reference in New Issue
Block a user