| @@ -59,9 +59,9 @@ | ||
| 59 | 59 | return array( |
| 60 | 60 | 'schema_version' => 2, // bumped: anon_id added (landing-experiments spec §5.1). |
| 61 | 61 | 'locale' => get_locale(), |
| 62 | 62 | 'plugin_version' => PLUGIN_VERSION, |
| 63 | - 'pro_active' => class_exists( '\WCPOS\WooCommercePOSPro\WooCommercePOSPro' ), | |
| 63 | + 'pro_active' => wcpos_is_pro_active(), | |
| 64 | 64 | 'anon_id' => $anon_id, |
| 65 | 65 | 'bootstrap_flags' => ( new Feature_Flags() )->get_landing_bootstrap_flags( $anon_id ), |
| 66 | 66 | ); |
| 67 | 67 | } |
| @@ -88,9 +88,9 @@ | ||
| 88 | 88 | * |
| 89 | 89 | * @return array |
| 90 | 90 | */ |
| 91 | 91 | public function get_profile(): array { |
| 92 | - $cached = $this->get_cached_metrics(); | |
| 92 | + $cached = $this->get_metrics(); | |
| 93 | 93 | $user = wp_get_current_user(); |
| 94 | 94 | |
| 95 | 95 | return array_merge( |
| 96 | 96 | $cached, |
| @@ -96,9 +96,9 @@ | ||
| 96 | 96 | $cached, |
| 97 | 97 | array( |
| 98 | 98 | 'wc_version' => WC()->version, |
| 99 | 99 | 'php_version' => PHP_VERSION, |
| 100 | - 'site_uuid' => get_option( 'woocommerce_pos_uuid', '' ), | |
| 100 | + 'site_uuid' => wcpos_get_site_uuid(), | |
| 101 | 101 | 'user_uuid' => get_user_meta( $user->ID, '_woocommerce_pos_uuid', true ), |
| 102 | 102 | 'user_role' => ! empty( $user->roles ) ? $user->roles[0] : '', |
| 103 | 103 | 'site_domain' => $this->get_url_host( home_url() ), |
| 104 | 104 | 'admin_domain' => $this->get_url_host( admin_url() ), |
| @@ -150,11 +150,15 @@ | ||
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | 152 | * Get cached expensive metrics, computing them if the cache is stale. |
| 153 | 153 | * |
| 154 | + * Public because the analytics site profile reports the same store-size | |
| 155 | + * numbers; sharing the cache keeps the count queries to one per hour | |
| 156 | + * instead of one per consumer. | |
| 157 | + * | |
| 154 | 158 | * @return array |
| 155 | 159 | */ |
| 156 | - private function get_cached_metrics(): array { | |
| 160 | + public function get_metrics(): array { | |
| 157 | 161 | $cached = get_transient( self::TRANSIENT_KEY ); |
| 158 | 162 | |
| 159 | 163 | if ( false !== $cached ) { |
| 160 | 164 | return $cached; |