PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.3
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
jetpack / jetpack_vendor / automattic / jetpack-premium-analytics / src / class-woocommerce-analytics-tracker.php

class-woocommerce-analytics-tracker.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.3, at jetpack_vendor/automattic/jetpack-premium-analytics/src/class-woocommerce-analytics-tracker.php

43 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Wires up the WooCommerce Analytics front-end tracker for Premium Analytics.
4 *
5 * @package automattic/jetpack-premium-analytics
6 */
7
8 namespace Automattic\Jetpack\PremiumAnalytics;
9
10 use Automattic\Woocommerce_Analytics;
11
12 /**
13 * Turns on the modern (ClickHouse + proxy) pipeline and triggers the vendored
14 * WooCommerce Analytics tracker, which self-gates on WooCommerce + connection
15 * and is idempotent.
16 */
17 class WooCommerce_Analytics_Tracker {
18
19 /**
20 * Register the tracker bootstrap.
21 */
22 public static function configure() {
23 add_action( 'after_setup_theme', array( __CLASS__, 'bootstrap' ) );
24 }
25
26 /**
27 * Enable the modern pipeline and trigger the tracker.
28 *
29 * On `after_setup_theme` the filters are in place before the package reads
30 * them while localizing `window.wcAnalytics` at `wp_footer`.
31 */
32 public static function bootstrap() {
33 add_filter( 'woocommerce_analytics_clickhouse_enabled', '__return_true' );
34 add_filter( 'woocommerce_analytics_experimental_proxy_tracking_enabled', '__return_true' );
35
36 // Guarded because the package ships with the Jetpack plugin or as a
37 // composer dependency, not with premium-analytics' own source.
38 if ( class_exists( Woocommerce_Analytics::class ) ) {
39 Woocommerce_Analytics::init();
40 }
41 }
42 }
43