> $ranges Window switcher: key, label, url, current. * @var bool $can_report Whether reporting is configured. * @var array $checklist Which of property ID and token are set. * @var string $settings_url Address of the settings screen. * @var string $refresh_action admin-post action that clears the cache. * @var string $refresh_url admin-post.php. * @var string $range_arg Query argument carrying the window. * @var \AdPix\Analytics\Service\Countries $countries Country code translator. * @var string $logo_url URL of the AdPix mark. * @var \AdPix\Analytics\Model\Report $overview Totals. Absent when reporting is unconfigured. * @var \AdPix\Analytics\Model\Report $timeseries Daily series. * @var \AdPix\Analytics\Model\Report $geo Countries. * @var \AdPix\Analytics\Model\Report $channels How visitors arrived. * @var \AdPix\Analytics\Model\Report $pages Most-read pages. * @var \AdPix\Analytics\Model\Report $devices Device types. * @var array $diagnosis Only on "not found": ok, error, properties (id, name). * @var string $property_id Only on "not found": the configured property ID. */ use AdPix\Analytics\Service\StatsService; use AdPix\Analytics\View\Format; defined( 'ABSPATH' ) || exit; /** * Turn a report's rows into what the table partial draws. * * @param \AdPix\Analytics\Model\Report $report Report to read. * @param callable|null $labeller Optional map from raw dimension to label and badge. * @return array> */ $adpix_rows = static function ( $report, $labeller = null ): array { $rows = array(); foreach ( $report->rows() as $row ) { $raw = isset( $row['dimensions'][0] ) ? (string) $row['dimensions'][0] : ''; $named = is_callable( $labeller ) ? $labeller( $raw ) : array( 'label' => '' !== $row['label'] ? $row['label'] : $raw, 'badge' => '' ); $rows[] = array( 'label' => '' !== $named['label'] ? $named['label'] : __( '(not set)', 'adpix-analytics' ), 'badge' => $named['badge'], 'values' => isset( $row['values'] ) && is_array( $row['values'] ) ? $row['values'] : array(), ); } return $rows; }; $adpix_currency = isset( $overview ) ? $overview->meta( 'currency' ) : ''; // Help text names the dashboard's own labels in bold, so the reader can match them on the other screen. $adpix_markup = array( 'strong' => array(), 'code' => array(), ); ?>

ok() && '' !== $overview->meta( 'start' ) ) : ?> meta( 'start' ) ) ), esc_html( Format::date( $overview->meta( 'end' ) ) ), esc_html( '' !== $overview->meta( 'timezone' ) ? $overview->meta( 'timezone' ) : __( 'the property timezone', 'adpix-analytics' ) ) ); ?>

__( 'Property ID', 'adpix-analytics' ), 'api_token' => __( 'API token', 'adpix-analytics' ), ); ?>

    $adpix_label ) : ?>

  1. Admin → API & MCP and choose the REST API tab. It must say Included for this site. If it says Not in plan, the property’s plan has no API access and this screen cannot work until the plan changes.', 'adpix-analytics' ), $adpix_markup ); ?>
  2. Quickstart box on the same tab, copy the long ID between /properties/ and /reports/. This is your Property ID. If the plugin already sends measurements, it is filled in already.', 'adpix-analytics' ), $adpix_markup ); ?>
  3. Service tokens tab and click + Create service token. Name it after this site, keep Reports ticked, and leave Hide revenue metrics unticked so the conversion value can be shown. Pick an expiry of up to 365 days; you will need a new token when it runs out.', 'adpix-analytics' ), $adpix_markup ); ?>
  4. Create token and copy it straight away. It starts with adpx_live_ and is shown only once. This is your API token.', 'adpix-analytics' ), $adpix_markup ); ?>

  1. Connection tab and scroll to Reading your statistics. Paste the API token, check the Property ID above it, then click Save changes.', 'adpix-analytics' ), $adpix_markup ); ?>

Only an account admin can create and manage service tokens, ask your account admin to create one and send it to you securely.', 'adpix-analytics' ), $adpix_markup ); ?>

ok() ) : ?>

error() ); ?>

Admin → API & MCP → REST API with this site selected: if it says Not in plan, upgrade the plan of this site. If you belong to several AdPix accounts, also check the token was created under the account that owns this site.', 'adpix-analytics' ), $adpix_markup ); ?>

Admin → API & MCP → REST API. If it says Not in plan, upgrade the plan of this site; the same token starts working without being created again. Otherwise the token belongs to a different AdPix account than this site.', 'adpix-analytics' ), $adpix_markup ); ?>

' . esc_html__( 'settings', 'adpix-analytics' ) . '' ), array( 'a' => array( 'href' => array() ) ) ); ?>

'totalUsers', 'icon' => 'dashicons-groups', 'hint' => __( 'People who came to the site, counted once each.', 'adpix-analytics' ), ), array( 'metric' => 'sessions', 'icon' => 'dashicons-visibility', 'hint' => __( 'Separate occasions somebody arrived and looked around.', 'adpix-analytics' ), ), array( 'metric' => 'pageviews', 'icon' => 'dashicons-media-document', 'hint' => __( 'Pages opened, including repeat views of the same page.', 'adpix-analytics' ), ), array( 'metric' => 'conversions', 'icon' => 'dashicons-yes-alt', 'hint' => __( 'Events your property counts as an outcome worth having.', 'adpix-analytics' ), ), array( 'metric' => 'conversionValue', 'icon' => 'dashicons-chart-line', 'hint' => __( 'What those outcomes were worth, in the property currency.', 'adpix-analytics' ), ), ); ?>
  • total( $adpix_tile['metric'] ), $adpix_currency ) ); ?>
ok() ) : ?>

error() ); ?>

render( 'stats/chart', array( 'report' => $timeseries, 'title' => sprintf( /* translators: %s: name of the reporting period, e.g. "Last 28 days". */ __( 'Visits over time — %s', 'adpix-analytics' ), StatsService::range_label( $range ) ), 'id' => 'adpix-visits', 'series' => array( array( 'metric' => 'sessions', 'label' => Format::metric( 'sessions' ), 'class' => 'adpix-series--1', ), array( 'metric' => 'totalUsers', 'label' => Format::metric( 'totalUsers' ), 'class' => 'adpix-series--2', ), array( 'metric' => 'pageviews', 'label' => Format::metric( 'pageviews' ), 'class' => 'adpix-series--3', ), ), ) ); ?>
render( 'stats/table', array( 'title' => __( 'Where your visitors are', 'adpix-analytics' ), 'icon' => 'dashicons-admin-site-alt3', 'heading' => __( 'Country', 'adpix-analytics' ), 'rows' => $adpix_rows( $geo, static function ( string $code ) use ( $countries ): array { return array( 'label' => $countries->name( $code ), 'badge' => $countries->flag( $code ), ); } ), 'metrics' => array( array( 'key' => 'sessions', 'label' => Format::metric( 'sessions' ), ), array( 'key' => 'totalUsers', 'label' => Format::metric( 'totalUsers' ), ), ), 'peak' => $geo->peak( 'sessions' ), 'total' => $geo->ok() ? max( $geo->total( 'sessions' ), array_sum( $geo->series( 'sessions' ) ) ) : 0.0, 'currency' => $adpix_currency, 'error' => $geo->error(), 'truncated' => $geo->is_truncated(), 'empty' => __( 'No visits could be placed on a map in this period.', 'adpix-analytics' ), ) ); $this->render( 'stats/table', array( 'title' => __( 'How they found you', 'adpix-analytics' ), 'icon' => 'dashicons-randomize', 'heading' => __( 'Channel', 'adpix-analytics' ), 'rows' => $adpix_rows( $channels ), 'metrics' => array( array( 'key' => 'sessions', 'label' => Format::metric( 'sessions' ), ), array( 'key' => 'totalUsers', 'label' => Format::metric( 'totalUsers' ), ), ), 'peak' => $channels->peak( 'sessions' ), 'total' => $channels->ok() ? max( $channels->total( 'sessions' ), array_sum( $channels->series( 'sessions' ) ) ) : 0.0, 'currency' => $adpix_currency, 'error' => $channels->error(), 'truncated' => $channels->is_truncated(), 'empty' => __( 'No arrivals were recorded in this period.', 'adpix-analytics' ), ) ); $this->render( 'stats/table', array( 'title' => __( 'Most-read pages', 'adpix-analytics' ), 'icon' => 'dashicons-media-text', 'heading' => __( 'Page', 'adpix-analytics' ), 'rows' => $adpix_rows( $pages ), 'metrics' => array( array( 'key' => 'pageviews', 'label' => Format::metric( 'pageviews' ), ), array( 'key' => 'sessions', 'label' => Format::metric( 'sessions' ), ), ), 'peak' => $pages->peak( 'pageviews' ), 'total' => $pages->ok() ? max( $pages->total( 'pageviews' ), array_sum( $pages->series( 'pageviews' ) ) ) : 0.0, 'currency' => $adpix_currency, 'error' => $pages->error(), 'truncated' => $pages->is_truncated(), 'empty' => __( 'No page views were recorded in this period.', 'adpix-analytics' ), ) ); $this->render( 'stats/donut', array( 'title' => __( 'What they were using', 'adpix-analytics' ), 'icon' => 'dashicons-smartphone', 'rows' => $adpix_rows( $devices ), 'metric' => Format::metric( 'sessions' ), 'error' => $devices->error(), 'empty' => __( 'No device information was recorded in this period.', 'adpix-analytics' ), 'id' => 'adpix-devices', ) ); ?>

meta( 'freshness' ) ) { $adpix_notes[] = sprintf( /* translators: %s: how current the figures are, as reported by AdPix. */ __( 'Data freshness: %s.', 'adpix-analytics' ), $overview->meta( 'freshness' ) ); } if ( '' !== $overview->meta( 'attribution' ) ) { $adpix_notes[] = sprintf( /* translators: %s: the attribution model these figures were produced with. */ __( 'Attribution model: %s.', 'adpix-analytics' ), $overview->meta( 'attribution' ) ); } $adpix_notes[] = __( 'Figures are read from AdPix and cached here for ten minutes.', 'adpix-analytics' ); echo esc_html( implode( ' ', $adpix_notes ) ); ?>