array( 'chat_profile' ), 'ai_chat_question' => array( 'chat_profile', 'question_source' ), 'ai_chat_answer' => array( 'chat_profile', 'sources', 'products' ), 'ai_chat_source_click' => array( 'chat_profile', 'link_url' ), 'ai_chat_product_click' => array( 'chat_profile', 'link_url', 'product_action' ), 'ai_chat_feedback' => array( 'chat_profile', 'rating' ), 'ai_chat_contact' => array( 'chat_profile' ), ); /** * Whether the chat reports events to the site's analytics. * * @param array|null $options Settings; the saved ones when omitted. * @return bool */ public static function enabled( $options = null ) { if ( ! is_array( $options ) ) { $options = get_option( 'ai_chat_bedrock_settings', array() ); $options = is_array( $options ) ? $options : array(); } return ! empty( $options['analytics_events'] ); } /** * Analytics plugins on this site whose tag receives the events, by name. * * @return string[] */ public static function tools() { $tools = array( 'Site Kit by Google' => defined( 'GOOGLESITEKIT_VERSION' ), 'MonsterInsights' => defined( 'MONSTERINSIGHTS_VERSION' ), 'GTM4WP' => defined( 'GTM4WP_VERSION' ), 'Matomo' => defined( 'MATOMO_ANALYTICS_FILE' ), 'Plausible Analytics' => defined( 'PLAUSIBLE_ANALYTICS_PLUGIN_FILE' ), ); return array_keys( array_filter( $tools ) ); } }