File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/scorecard.tar
class-scorecard-age.php 0000644 00000004325 15154771435 0011077 0 ustar 00 <?php
/**
* Class that handles the output for the Age Breakdown scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Age
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Age extends MonsterInsights_SiteInsights_Metric_Template {
protected $metric = 'age';
protected $type = 'scorecard';
public function output(){
$data = $this->get_options();
if (empty($data)) {
return false;
}
$content = $this->get_table_template(
$data['headers'],
$data['rows']
);
return sprintf(
"<div class=\"monsterinsights-table-scorecard with-3-columns\">%s</div>",
$content
);
}
/**
* Returns data needed for this block.
*
* @return array|false
*/
protected function get_options() {
if (empty($this->data['age'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$data = $this->data['age'];
$rows = array();
foreach ($data as $key => $item) {
$rows[$key] = array(
$item['age'],
$item['sessions'],
$item['percent'] . '%'
);
}
return array(
'rows' => $rows,
'headers' => array(
__( 'Age Range', 'google-analytics-for-wordpress' ),
__( 'Sessions', 'google-analytics-for-wordpress' ),
__( 'Percent', 'google-analytics-for-wordpress' )
),
);
}
private function get_table_template( $headers, $rows ) {
$headers_output = '';
$countries_output = '';
foreach ( $headers as $key => $head ) {
$headers_output .= sprintf( '<div class="monsterinsights-scorecard-table-head">%s</div>', $head );
}
foreach ( $rows as $key => $row ) {
$items = '';
foreach ( $row as $i => $column ) {
$items .= sprintf( '<div class="monsterinsights-scorecard-table-column">%s</div>', $column );
}
$countries_output .= sprintf( '<div class="monsterinsights-scorecard-table-row">%s</div>', $items );
}
$header = sprintf(
'<div class="monsterinsights-scorecard-table-header">%s</div>',
$headers_output
);
$content = sprintf(
'<div class="monsterinsights-scorecard-table-rows">%s</div>',
$countries_output
);
$format = '<div class="monsterinsights-scorecard-table">%s</div>';
return sprintf(
$format,
$header . $content
);
}
} class-scorecard-device.php 0000644 00000004477 15154771436 0011613 0 ustar 00 <?php
/**
* Class that handles the output for the Device Breakdown scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Device
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Device extends MonsterInsights_SiteInsights_Metric_Template {
protected $metric = 'device';
protected $type = 'scorecard';
public function output(){
$json_data = $this->get_json_data();
if (empty($json_data)) {
return false;
}
return "<div class='monsterinsights-graph-item monsterinsights-graph-{$this->metric}'>
<script type='application/json'>{$json_data}</script>
</div>";
}
protected function get_options() {
if (empty($this->data['devices'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$textColor = $this->attributes['textColor'];
$title = __( 'Device Breakdown', 'google-analytics-for-wordpress' );
$data = $this->data['devices'];
$series = array_values( $data );
$labels = array_keys( $data );
$options = array(
'series' => array(
array(
'data' => $series
)
),
'title' => array(
'text' => $title,
'style' => array(
'color' => $textColor,
'fontSize' => '20px',
)
),
'chart' => array(
'type' => 'bar',
'height' => 240,
'width' => "90%",
'toolbar' => array(
'show' => false
)
),
'colors' => array( $primaryColor, $secondaryColor ),
'tooltip' => array(
'enabled' => false
),
'grid' => array(
'show' => false
),
'plotOptions' => array(
'bar' => array(
'borderRadius' => 5,
'horizontal' => true,
'columnWidth' => '33%',
'dataLabels' => array(
'position' => 'center',
)
)
),
'dataLabels' => array(
'style' => array(
'colors' => array( $textColor )
),
'formatter' => array(
'args' => 'value',
'body' => 'return value + "%"',
)
),
'xaxis' => array(
'show' => false,
'categories' => $labels,
'axisBorder' => array(
'show' => false
),
'labels' => array(
'show' => false
),
'axisTicks' => array(
'show' => false
)
),
'yaxis' => array(
'show' => true,
'labels' => array(
'show' => true
),
'axisTicks' => array(
'show' => false
)
),
);
return $options;
}
} class-scorecard-gender.php 0000644 00000004347 15154771436 0011614 0 ustar 00 <?php
/**
* Class that handles the output for the Gender Breakdown scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Gender
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Gender extends MonsterInsights_SiteInsights_Metric_Template {
protected $metric = 'gender';
protected $type = 'scorecard';
public function output(){
$data = $this->get_options();
if (empty($data)) {
return false;
}
$content = $this->get_table_template(
$data['headers'],
$data['rows']
);
return sprintf(
"<div class=\"monsterinsights-table-scorecard with-3-columns\">%s</div>",
$content
);
}
/**
* Returns data needed for this block.
*
* @return array|false
*/
protected function get_options() {
if (empty($this->data['gender'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$data = $this->data['gender'];
$rows = array();
foreach ($data as $key => $item) {
$rows[$key] = array(
$item['gender'],
$item['sessions'],
$item['percent'] . '%'
);
}
return array(
'rows' => $rows,
'headers' => array(
__( 'Gender', 'google-analytics-for-wordpress' ),
__( 'Sessions', 'google-analytics-for-wordpress' ),
__( 'Percent', 'google-analytics-for-wordpress' )
),
);
}
private function get_table_template( $headers, $rows ) {
$headers_output = '';
$countries_output = '';
foreach ( $headers as $key => $head ) {
$headers_output .= sprintf( '<div class="monsterinsights-scorecard-table-head">%s</div>', $head );
}
foreach ( $rows as $key => $row ) {
$items = '';
foreach ( $row as $i => $column ) {
$items .= sprintf( '<div class="monsterinsights-scorecard-table-column">%s</div>', $column );
}
$countries_output .= sprintf( '<div class="monsterinsights-scorecard-table-row">%s</div>', $items );
}
$header = sprintf(
'<div class="monsterinsights-scorecard-table-header">%s</div>',
$headers_output
);
$content = sprintf(
'<div class="monsterinsights-scorecard-table-rows">%s</div>',
$countries_output
);
$format = '<div class="monsterinsights-scorecard-table">%s</div>';
return sprintf(
$format,
$header . $content
);
}
} class-scorecard-newvsreturning.php 0000644 00000004726 15154771436 0013451 0 ustar 00 <?php
/**
* Class that handles the output for the New vs Returning scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Newvsreturning
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Newvsreturning extends MonsterInsights_SiteInsights_Metric_Template {
protected $metric = 'newvsreturning';
protected $type = 'scorecard';
public function output(){
$json_data = $this->get_json_data();
if (empty($json_data)) {
return false;
}
return "<div class='monsterinsights-graph-item monsterinsights-graph-{$this->metric}'>
<script type='application/json'>{$json_data}</script>
</div>";
}
protected function get_options() {
if (empty($this->data['newvsreturn'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$textColor = $this->attributes['textColor'];
$title = __( 'New vs Returning', 'google-analytics-for-wordpress' );
$data = $this->data['newvsreturn'];
$series = array( $data['returning'], $data['new'] );
$options = array(
'series' => array(
array(
'data' => $series
)
),
'title' => array(
'text' => $title,
'style' => array(
'color' => $textColor,
'fontSize' => '20px',
)
),
'chart' => array(
'type' => 'bar',
'height' => 160,
'width' => "90%",
'toolbar' => array(
'show' => false
)
),
'colors' => array( $primaryColor, $secondaryColor ),
'tooltip' => array(
'enabled' => false
),
'grid' => array(
'show' => false
),
'plotOptions' => array(
'bar' => array(
'borderRadius' => 5,
'horizontal' => true,
'columnWidth' => '50%',
'dataLabels' => array(
'position' => 'center',
)
)
),
'dataLabels' => array(
'style' => array(
'colors' => array( $textColor )
),
'formatter' => array(
'args' => 'value',
'body' => 'return value + "%"',
)
),
'xaxis' => array(
'show' => false,
'categories' => array(
__( 'New Visitors', 'google-analytics-for-wordpress' ),
__( 'Returning Visitors', 'google-analytics-for-wordpress' )
),
'axisBorder' => array(
'show' => false
),
'labels' => array(
'show' => false
),
'axisTicks' => array(
'show' => false
)
),
'yaxis' => array(
'show' => true,
'labels' => array(
'show' => true
),
'axisTicks' => array(
'show' => false
)
),
);
return $options;
}
} class-scorecard-pageviews.php 0000644 00000003325 15154771437 0012336 0 ustar 00 <?php
/**
* Class that handles the output for the Sessions scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Pageviews
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Pageviews extends MonsterInsights_SiteInsights_Template_DuoScorecard {
protected $metric = 'pageviews';
protected $type = 'scorecard';
public function output(){
$data = $this->get_options();
if (empty($data)) {
return false;
}
$duration = $data['duration']['value'];
$prev_duration = $data['duration']['prev'];
$bounce_rate = $data['bounce_rate']['value'];
$prev_bounce_rate = $data['bounce_rate']['prev'];
$left = $this->get_card_template(
'left',
__('Avg. Session Duration', 'google-analytics-for-wordpress'),
$duration,
$prev_duration,
__( 'vs. Previous 30 days', 'google-analytics-for-wordpress' ),
$data['withComparison']
);
$right = $this->get_card_template(
'right',
__('Bounce Rate', 'google-analytics-for-wordpress'),
$bounce_rate,
$prev_bounce_rate,
__( 'vs. Previous 30 days', 'google-analytics-for-wordpress' ),
$data['withComparison']
);
return sprintf(
"<div class=\"monsterinsights-duo-scorecard\">%s</div>",
$left . $right
);
}
/**
* Returns data needed for this block.
*
* @return array|false
*/
protected function get_options() {
if ( empty($this->data['infobox'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$withComparison = $this->attributes['withComparison'];
$data = $this->data['infobox'];
return array(
'duration' => $data['duration'],
'bounce_rate' => $data['bounce_rate'],
'withComparison' => $withComparison,
);
}
} class-scorecard-scrolldepth.php 0000644 00000002242 15154771440 0012656 0 ustar 00 <?php
/**
* Class that handles the output for the Scroll Depth scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Scrolldepth
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Scrolldepth extends MonsterInsights_SiteInsights_Metric_Template {
protected $metric = 'scrolldepth';
protected $type = 'scorecard';
public function output(){
$value = $this->get_options();
if ( empty($value) ) {
return null;
}
$format = '<div class="monsterinsights-scorecard-simple-card">
<div class="monsterinsights-scorecard-simple-card-value">%2$s</div>
<div class="monsterinsights-scorecard-simple-card-label">%1$s</div>
</div>';
return sprintf(
$format,
__( 'Average Scroll Depth', 'google-analytics-for-wordpress' ),
$value . '%'
);
}
/**
* Returns data needed for this block.
*
* @return array|false
*/
protected function get_options() {
if ( !isset($this->data['scroll']) || empty($this->data['scroll']['average'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$data = $this->data['scroll'];
return $data['average'];
}
} class-scorecard-sessions.php 0000644 00000003263 15154771442 0012207 0 ustar 00 <?php
/**
* Class that handles the output for the Sessions scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Sessions
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Sessions extends MonsterInsights_SiteInsights_Template_DuoScorecard {
protected $metric = 'sessions';
protected $type = 'scorecard';
public function output(){
$data = $this->get_options();
if (empty($data)) {
return false;
}
$sessions = $data['sessions']['value'];
$prev_sessions = $data['sessions']['prev'];
$pageviews = $data['pageviews']['value'];
$prev_pageviews = $data['pageviews']['prev'];
$left = $this->get_card_template(
'left',
__('Sessions', 'google-analytics-for-wordpress'),
$sessions,
$prev_sessions,
__( 'vs. Previous 30 days', 'google-analytics-for-wordpress' ),
$data['withComparison']
);
$right = $this->get_card_template(
'right',
__('Pageviews', 'google-analytics-for-wordpress'),
$pageviews,
$prev_pageviews,
__( 'vs. Previous 30 days', 'google-analytics-for-wordpress' ),
$data['withComparison']
);
return sprintf(
"<div class=\"monsterinsights-duo-scorecard\">%s</div>",
$left . $right
);
}
/**
* Returns data needed for this block.
*
* @return array|false
*/
protected function get_options() {
if ( empty($this->data['infobox'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$withComparison = $this->attributes['withComparison'];
$data = $this->data['infobox'];
return array(
'sessions' => $data['sessions'],
'pageviews' => $data['pageviews'],
'withComparison' => $withComparison,
);
}
} class-scorecard-top10countries.php 0000644 00000004271 15154771442 0013240 0 ustar 00 <?php
/**
* Class that handles the output for the Top 10 countries scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Top10countries
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Top10countries extends MonsterInsights_SiteInsights_Metric_Template {
protected $metric = 'top10countries';
protected $type = 'scorecard';
public function output(){
$data = $this->get_options();
if (empty($data)) {
return false;
}
$content = $this->get_table_template(
$data['headers'],
$data['rows']
);
return sprintf(
"<div class=\"monsterinsights-table-scorecard with-2-columns\">%s</div>",
$content
);
}
/**
* Returns data needed for this block.
*
* @return array|false
*/
protected function get_options() {
if ( empty($this->data['countries'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$data = $this->data['countries'];
$rows = array();
foreach ($data as $key => $country) {
$rows[$key] = array( $country['name'], $country['sessions'] );
}
return array(
'rows' => $rows,
'headers' => array(
__( 'Top 10 Countries', 'google-analytics-for-wordpress' ),
__( 'Sessions', 'google-analytics-for-wordpress' )
),
);
}
private function get_table_template( $headers, $rows ) {
$headers_output = '';
$countries_output = '';
foreach ( $headers as $key => $head ) {
$headers_output .= sprintf( '<div class="monsterinsights-scorecard-table-head">%s</div>', $head );
}
foreach ( $rows as $key => $row ) {
$items = '';
foreach ( $row as $i => $column ) {
$items .= sprintf( '<div class="monsterinsights-scorecard-table-column">%s</div>', $column );
}
$countries_output .= sprintf( '<div class="monsterinsights-scorecard-table-row">%s</div>', $items );
}
$header = sprintf(
'<div class="monsterinsights-scorecard-table-header">%s</div>',
$headers_output
);
$content = sprintf(
'<div class="monsterinsights-scorecard-table-rows">%s</div>',
$countries_output
);
$format = '<div class="monsterinsights-scorecard-table">%s</div>';
return sprintf(
$format,
$header . $content
);
}
} class-scorecard-topinterests.php 0000644 00000004270 15154771442 0013103 0 ustar 00 <?php
/**
* Class that handles the output for the Top Interests scorecard.
*
* Class MonsterInsights_SiteInsights_Template_Scorecard_Topinterests
*/
class MonsterInsights_SiteInsights_Template_Scorecard_Topinterests extends MonsterInsights_SiteInsights_Metric_Template {
protected $metric = 'topinterests';
protected $type = 'scorecard';
public function output(){
$data = $this->get_options();
if (empty($data)) {
return false;
}
$content = $this->get_table_template(
$data['headers'],
$data['rows']
);
return sprintf(
"<div class=\"monsterinsights-table-scorecard with-2-columns\">%s</div>",
$content
);
}
/**
* Returns data needed for this block.
*
* @return array|false
*/
protected function get_options() {
if ( empty($this->data['interest'])) {
return false;
}
$primaryColor = $this->attributes['primaryColor'];
$secondaryColor = $this->attributes['secondaryColor'];
$data = $this->data['interest'];
$rows = array();
foreach ($data as $key => $item) {
$rows[$key] = array(
$item['interest'],
$item['percent'] . '%'
);
}
return array(
'rows' => $rows,
'headers' => array(
__( 'Categories', 'google-analytics-for-wordpress' ),
__( '% of Interest', 'google-analytics-for-wordpress' )
),
);
}
private function get_table_template( $headers, $rows ) {
$headers_output = '';
$countries_output = '';
foreach ( $headers as $key => $head ) {
$headers_output .= sprintf( '<div class="monsterinsights-scorecard-table-head">%s</div>', $head );
}
foreach ( $rows as $key => $row ) {
$items = '';
foreach ( $row as $i => $column ) {
$items .= sprintf( '<div class="monsterinsights-scorecard-table-column">%s</div>', $column );
}
$countries_output .= sprintf( '<div class="monsterinsights-scorecard-table-row">%s</div>', $items );
}
$header = sprintf(
'<div class="monsterinsights-scorecard-table-header">%s</div>',
$headers_output
);
$content = sprintf(
'<div class="monsterinsights-scorecard-table-rows">%s</div>',
$countries_output
);
$format = '<div class="monsterinsights-scorecard-table">%s</div>';
return sprintf(
$format,
$header . $content
);
}
}