Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Analytics Report header template.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Admin
|
||||
*/
|
||||
|
||||
use RankMath\Helper;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
?>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="report-info">
|
||||
<tr>
|
||||
<td>
|
||||
<h1><?php esc_html_e( 'SEO Report of Your Website', 'rank-math-pro' ); ?></h1>
|
||||
###TOP_HTML###
|
||||
<h2 class="report-date">###START_DATE### - ###END_DATE###</h2>
|
||||
<a href="###SITE_URL###" target="_blank" class="site-url">###SITE_URL_SIMPLE###</a>
|
||||
</td>
|
||||
<?php if ( $this->get_setting( 'link_full_report', true ) ) : ?>
|
||||
<td class="full-report-link">
|
||||
<a href="###REPORT_URL###" target="_blank" class="full-report-link">
|
||||
<?php esc_html_e( 'FULL REPORT', 'rank-math-pro' ); ?>
|
||||
<?php $this->image( 'report-icon-external.png', 12, 12, __( 'External Link Icon', 'rank-math-pro' ) ); ?>
|
||||
</a>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<?php if ( $this->get_variable( 'stats_invalid_data' ) ) { ?>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="report-error">
|
||||
<tr>
|
||||
<td>
|
||||
<h2><?php esc_html_e( 'Uh-oh', 'rank-math-pro' ); ?></h2>
|
||||
<p><em><?php esc_html_e( 'It seems that there are no stats to show right now.', 'rank-math-pro' ); ?></em></p>
|
||||
<?php // Translators: placeholders are anchor opening and closing tags. ?>
|
||||
<p><?php printf( esc_html__( 'If you can see the site data in your Search Console and Analytics accounts, but not here, then %1$s try reconnecting your account %2$s and make sure that the correct properties are selected in the %1$s Analytics Settings%2$s.', 'rank-math-pro' ), '<a href="' . Helper::get_admin_url( 'options-general#setting-panel-analytics' ) . '">', '</a>' ); ?></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php } ?>
|
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Analytics Report email styling.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Admin
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
?>
|
||||
<style>
|
||||
|
||||
.header {
|
||||
background: ###HEADER_BACKGROUND###;
|
||||
}
|
||||
|
||||
tr.keywords-table-spacer {
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
table.stats-table tr.table-heading {
|
||||
background: #243B53;
|
||||
color: #fff;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.stats-table {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.stats-table td {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.stats-table tr:nth-child(2n+1) {
|
||||
background: #F0F4F8;
|
||||
}
|
||||
|
||||
.stats-table .stat-value {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.stats-table .stat-diff, .stats-table .diff-sign {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.report-heading {
|
||||
margin: 40px 0 20px 0;
|
||||
}
|
||||
|
||||
span.post-title, span.post-url {
|
||||
display: block;
|
||||
max-width: 250px;
|
||||
}
|
||||
|
||||
.stats-table a {
|
||||
color: #3f77d6;
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
span.post-url {
|
||||
color: #92949f;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
###CUSTOM_CSS###
|
||||
</style>
|
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Analytics Report email template.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Admin
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$sections = $this->get_setting( 'sections', [ 'summary', 'positions', 'winning_posts', 'winning_keywords', 'losing_keywords' ] );
|
||||
|
||||
$analytics = get_option( 'rank_math_google_analytic_options' );
|
||||
$is_analytics_connected = ! empty( $analytics ) && ! empty( $analytics['view_id'] );
|
||||
|
||||
// Header & optional sections.
|
||||
$this->template_part( 'header' );
|
||||
$this->template_part( 'header-after' );
|
||||
|
||||
foreach ( $sections as $section ) {
|
||||
$template = str_replace( '_', '-', $section );
|
||||
$this->template_part( "sections/{$template}", [ 'analytics_connected' => $is_analytics_connected ] );
|
||||
}
|
||||
|
||||
// phpcs:enable
|
||||
?>
|
||||
<?php if ( $this->get_setting( 'link_full_report', true ) ) : ?>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="details-button">
|
||||
<tr class="button">
|
||||
<td align="left">
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="left" style="padding-bottom: 0;">
|
||||
<a href="###REPORT_URL###" target="_blank"><?php esc_html_e( 'VIEW DETAILED ANALYTICS', 'rank-math-pro' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $this->template_part( 'footer' ); ?>
|
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Analytics Report Losing Keywords.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Admin
|
||||
*/
|
||||
|
||||
use RankMathPro\Analytics\Email_Reports;
|
||||
use MyThemeShop\Helpers\Str;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$keywords = (array) $this->get_variable( 'losing_keywords' );
|
||||
|
||||
?>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="report-heading">
|
||||
<tr>
|
||||
<td>
|
||||
<h2><?php esc_html_e( 'Top Losing Keywords', 'rank-math-pro' ); ?></h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="keywords-table-wrapper">
|
||||
<tr>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="keywords-table stats-table losing-keywords">
|
||||
<tr class="table-heading">
|
||||
<td class="col-1">
|
||||
<?php esc_html_e( 'Keywords', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<td class="col-2">
|
||||
<?php esc_html_e( 'Impressions', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<td class="col-3">
|
||||
<?php esc_html_e( 'Position', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php foreach ( $keywords as $keyword => $data ) : ?>
|
||||
<?php if ( ! is_array( $data ) ) { continue; } ?>
|
||||
<tr>
|
||||
<td style="width:280px;box-sizing:border-box;">
|
||||
<span title="<?php echo esc_html( $keyword ); ?>"><?php echo esc_html( Str::truncate( $keyword, 36, '...' ) ); ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<?php $this->template_part( 'stat', Email_Reports::get_stats_val( $data, 'impressions' ) ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php $this->template_part( 'stat', array_merge( Email_Reports::get_stats_val( $data, 'position' ), [ 'invert' => true ] ) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if ( empty( $keywords ) ) : ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php esc_html_e( 'No data to show.', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Analytics Report Losing Posts.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Admin
|
||||
*/
|
||||
|
||||
use RankMathPro\Analytics\Email_Reports;
|
||||
use MyThemeShop\Helpers\Str;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$posts = (array) $this->get_variable( 'losing_posts' );
|
||||
|
||||
?>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="report-heading">
|
||||
<tr>
|
||||
<td>
|
||||
<h2><?php esc_html_e( 'Top Losing Posts', 'rank-math-pro' ); ?></h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="traffic-table stats-table">
|
||||
<tr class="table-heading">
|
||||
<td class="col-1">
|
||||
<?php esc_html_e( 'Post', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<?php if ( ! empty( $analytics_connected ) ) : ?>
|
||||
<td class="col-2">
|
||||
<?php esc_html_e( 'Search Traffic', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<?php else : ?>
|
||||
<td class="col-2">
|
||||
<?php esc_html_e( 'Impressions', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="col-3">
|
||||
<?php esc_html_e( 'Position', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php foreach ( $posts as $post_url => $data ) : // phpcs:disable ?>
|
||||
<?php if ( ! is_array( $data ) ) { continue; } ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="###SITE_URL###<?php echo esc_attr( $post_url ); ?>" target="_blank">
|
||||
<span class="post-title"><?php echo esc_html( Str::truncate( ( ! empty( $data['title'] ) ? $data['title'] : $data['page'] ), 55, '...' ) ); ?></span>
|
||||
<span class="post-url"><?php echo esc_html( Email_Reports::shorten_url( $post_url, 30, '...' ) ); ?></span>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ( ! empty( $analytics_connected ) ) : ?>
|
||||
<?php $this->template_part( 'stat', Email_Reports::get_stats_val( $data, 'pageviews' ) ); ?>
|
||||
<?php else : ?>
|
||||
<?php $this->template_part( 'stat', Email_Reports::get_stats_val( $data, 'impressions' ) ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php $this->template_part( 'stat', array_merge( Email_Reports::get_stats_val( $data, 'position' ), [ 'invert' => true ] ) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if ( empty( $posts ) ) : ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php esc_html_e( 'No data to show.', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* Analytics Report summary table template.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Admin
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$analytics = get_option( 'rank_math_google_analytic_options' );
|
||||
$is_analytics_connected = ! empty( $analytics ) && ! empty( $analytics['view_id'] );
|
||||
|
||||
?>
|
||||
|
||||
<?php if ( $this->get_variable( 'stats_invalid_data' ) ) { ?>
|
||||
<?php return; ?>
|
||||
<?php } ?>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="stats">
|
||||
<tr>
|
||||
<?php if ( $is_analytics_connected ) : ?>
|
||||
<td class="col-1">
|
||||
<h3><?php esc_html_e( 'Search Traffic', 'rank-math-pro' ); ?></h3>
|
||||
<?php
|
||||
$this->template_part(
|
||||
'stat',
|
||||
[
|
||||
'value' => $this->get_variable( 'stats_traffic' ),
|
||||
'diff' => $this->get_variable( 'stats_traffic_diff' ),
|
||||
'graph' => true,
|
||||
'graph_data' => $this->get_graph_data( 'traffic' ),
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<?php else : ?>
|
||||
<td class="col-1">
|
||||
<h3><?php esc_html_e( 'Total Impressions', 'rank-math-pro' ); ?></h3>
|
||||
<?php
|
||||
$this->template_part(
|
||||
'stat',
|
||||
[
|
||||
'value' => $this->get_variable( 'stats_impressions' ),
|
||||
'diff' => $this->get_variable( 'stats_impressions_diff' ),
|
||||
'graph' => true,
|
||||
'graph_data' => $this->get_graph_data( 'impressions' ),
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<?php if ( ! $is_analytics_connected ) : ?>
|
||||
<td class="col-2">
|
||||
<h3><?php esc_html_e( 'Total Clicks', 'rank-math-pro' ); ?></h3>
|
||||
<?php
|
||||
$this->template_part(
|
||||
'stat',
|
||||
[
|
||||
'value' => $this->get_variable( 'stats_clicks' ),
|
||||
'diff' => $this->get_variable( 'stats_clicks_diff' ),
|
||||
'graph' => true,
|
||||
'graph_data' => $this->get_graph_data( 'clicks' ),
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<?php else : ?>
|
||||
<td class="col-2">
|
||||
<h3><?php esc_html_e( 'Total Impressions', 'rank-math-pro' ); ?></h3>
|
||||
<?php
|
||||
$this->template_part(
|
||||
'stat',
|
||||
[
|
||||
'value' => $this->get_variable( 'stats_impressions' ),
|
||||
'diff' => $this->get_variable( 'stats_impressions_diff' ),
|
||||
'graph' => true,
|
||||
'graph_data' => $this->get_graph_data( 'impressions' ),
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-1">
|
||||
<h3><?php esc_html_e( 'Total Keywords', 'rank-math-pro' ); ?></h3>
|
||||
<?php
|
||||
$this->template_part(
|
||||
'stat',
|
||||
[
|
||||
'value' => $this->get_variable( 'stats_keywords' ),
|
||||
'diff' => $this->get_variable( 'stats_keywords_diff' ),
|
||||
'graph' => true,
|
||||
'graph_data' => $this->get_graph_data( 'keywords' ),
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
<td class="col-2">
|
||||
<h3><?php esc_html_e( 'Average Position', 'rank-math-pro' ); ?></h3>
|
||||
<?php
|
||||
$this->template_part(
|
||||
'stat',
|
||||
[
|
||||
'value' => $this->get_variable( 'stats_position' ),
|
||||
'diff' => $this->get_variable( 'stats_position_diff' ),
|
||||
'graph' => true,
|
||||
'graph_data' => $this->get_graph_data( 'position' ),
|
||||
'graph_modifier' => -100,
|
||||
'human_number' => false,
|
||||
]
|
||||
);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
/**
|
||||
* Analytics Report Winning Keywords.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Admin
|
||||
*/
|
||||
|
||||
use RankMathPro\Analytics\Email_Reports;
|
||||
use MyThemeShop\Helpers\Str;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$keywords = (array) $this->get_variable( 'winning_keywords' );
|
||||
|
||||
?>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="report-heading">
|
||||
<tr>
|
||||
<td>
|
||||
<h2><?php esc_html_e( 'Top Winning Keywords', 'rank-math-pro' ); ?></h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="keywords-table-wrapper">
|
||||
<tr>
|
||||
<td>
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="keywords-table stats-table winning-keywords">
|
||||
<tr class="table-heading">
|
||||
<td class="col-1">
|
||||
<?php esc_html_e( 'Keywords', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<td class="col-2">
|
||||
<?php esc_html_e( 'Impressions', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<td class="col-3">
|
||||
<?php esc_html_e( 'Position', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php foreach ( $keywords as $keyword => $data ) : ?>
|
||||
<?php if ( ! is_array( $data ) ) { continue; } ?>
|
||||
<tr>
|
||||
<td style="width:280px;box-sizing:border-box;">
|
||||
<span title="<?php echo esc_html( $keyword ); ?>"><?php echo esc_html( Str::truncate( $keyword, 36, '...' ) ); ?></span>
|
||||
</td>
|
||||
<td>
|
||||
<?php $this->template_part( 'stat', Email_Reports::get_stats_val( $data, 'impressions' ) ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php $this->template_part( 'stat', array_merge( Email_Reports::get_stats_val( $data, 'position' ), [ 'invert' => true ] ) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if ( empty( $keywords ) ) : ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php esc_html_e( 'No data to show.', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* Analytics Report Winning Posts.
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Admin
|
||||
*/
|
||||
|
||||
use RankMathPro\Analytics\Email_Reports;
|
||||
use MyThemeShop\Helpers\Str;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$posts = (array) $this->get_variable( 'winning_posts' );
|
||||
|
||||
?>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="report-heading">
|
||||
<tr>
|
||||
<td>
|
||||
<h2><?php esc_html_e( 'Top Winning Posts', 'rank-math-pro' ); ?></h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="traffic-table stats-table">
|
||||
<tr class="table-heading">
|
||||
<td class="col-1">
|
||||
<?php esc_html_e( 'Post', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<?php if ( ! empty( $analytics_connected ) ) : ?>
|
||||
<td class="col-2">
|
||||
<?php esc_html_e( 'Search Traffic', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<?php else : ?>
|
||||
<td class="col-2">
|
||||
<?php esc_html_e( 'Impressions', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
<td class="col-3">
|
||||
<?php esc_html_e( 'Position', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php foreach ( $posts as $post_url => $data ) : // phpcs:disable ?>
|
||||
<?php if ( ! is_array( $data ) ) { continue; } ?>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="###SITE_URL###<?php echo esc_attr( $post_url ); ?>" target="_blank">
|
||||
<span class="post-title"><?php echo esc_html( Str::truncate( ( ! empty( $data['title'] ) ? $data['title'] : $data['page'] ), 55, '...' ) ); ?></span>
|
||||
<span class="post-url"><?php echo esc_html( Email_Reports::shorten_url( $post_url, 30, '...' ) ); ?></span>
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<?php if ( ! empty( $analytics_connected ) ) : ?>
|
||||
<?php $this->template_part( 'stat', Email_Reports::get_stats_val( $data, 'pageviews' ) ); ?>
|
||||
<?php else : ?>
|
||||
<?php $this->template_part( 'stat', Email_Reports::get_stats_val( $data, 'impressions' ) ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php $this->template_part( 'stat', array_merge( Email_Reports::get_stats_val( $data, 'position' ), [ 'invert' => true ] ) ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php if ( empty( $posts ) ) : ?>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<?php esc_html_e( 'No data to show.', 'rank-math-pro' ); ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
</table>
|
Reference in New Issue
Block a user