芝麻web文件管理V1.00
编辑当前文件:/home/dcqnetm/intuns/uh/tracking/class-tracking-gtag.php
$linker_domains, ]; } if ( monsterinsights_is_debug_mode() ) { $options['debug_mode'] = true; } $options = apply_filters( 'monsterinsights_frontend_tracking_options_gtag_before_pageview', $options ); $options = apply_filters( 'monsterinsights_frontend_tracking_options_before_pageview', $options, $this->name, $this->version ); if ( is_404() ) { if ( monsterinsights_get_option( 'hash_tracking', false ) ) { $options['page_path'] = "{$placeholder}'/404.html?page=' + document.location.pathname + document.location.search + location.hash + '&from=' + document.referrer{$placeholder}"; } else { $options['page_path'] = "{$placeholder}'/404.html?page=' + document.location.pathname + document.location.search + '&from=' + document.referrer{$placeholder}"; } } elseif ( $wp_query->is_search ) { $pushstr = "/?s="; if ( 0 === (int) $wp_query->found_posts ) { $options['page_path'] = $pushstr . 'no-results:' . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=no-results"; } elseif ( 1 === (int) $wp_query->found_posts ) { $options['page_path'] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=1-result"; } elseif ( $wp_query->found_posts > 1 && $wp_query->found_posts < 6 ) { $options['page_path'] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=2-5-results"; } else { $options['page_path'] = $pushstr . rawurlencode( $wp_query->query_vars['s'] ) . "&cat=plus-5-results"; } } elseif ( monsterinsights_get_option( 'hash_tracking', false ) ) { $options['page_path'] = "{$placeholder}location.pathname + location.search + location.hash{$placeholder}"; } if ( monsterinsights_get_option( 'userid', false ) && is_user_logged_in() ) { $value = get_current_user_id(); $options['wp_user_id'] = $value; } $options = apply_filters( 'monsterinsights_frontend_tracking_options_gtag_end', $options ); if ( $encoded ) { return str_replace( [ '"' . $placeholder, $placeholder . '"' ], '', wp_json_encode( $options ) ); } return $options; } /** * Get frontend output. * * This function is used to return the Javascript * to output in the head of the page for the given * tracking method. * * @return string javascript to output * * @since 7.15.0 */ public function frontend_output() { $options_v4 = $this->frontend_tracking_options( true ); $persistent = $this->frontend_tracking_options_persistent(); $v4_id = monsterinsights_get_v4_id_to_output(); $src = apply_filters( 'monsterinsights_frontend_output_gtag_src', '//www.googletagmanager.com/gtag/js?id=' . $v4_id ); $compat_mode = apply_filters( 'monsterinsights_get_option_gtagtracker_compatibility_mode', true ); $compat = $compat_mode ? 'window.gtag = __gtagTracker;' : ''; $track_user = monsterinsights_track_user(); $output = ''; $reason = ''; $attr_string = monsterinsights_get_frontend_analytics_script_atts(); $gtag_async = apply_filters( 'monsterinsights_frontend_gtag_script_async', true ) ? 'async' : ''; if ( defined('cmplz_plugin') || defined('cmplz_premium') || defined('cmplz_free') ) { add_filter( 'cmplz_known_script_tags', function( $tags ) { $tags[] = array( 'name' => 'google-analytics', 'category' => 'statistics', 'urls' => array( 'www.googletagmanager.com/gtag/js', 'googletagmanager.com/gtag/js', 'googletagmanager.com', '__gtagTracker', 'MonsterInsightsDualTracker', 'monsterinsights_frontend_tracking_gtag_after_pageview', ), ); return $tags; }); } ob_start(); ?> ' . PHP_EOL; } elseif ( current_user_can( 'monsterinsights_save_settings' ) ) { $reason = __( 'Note: MonsterInsights does not track you as a logged-in site administrator to prevent site owners from accidentally skewing their own Google Analytics data.' . PHP_EOL . 'If you are testing Google Analytics code, please do so either logged out or in the private browsing/incognito mode of your web browser.', 'google-analytics-for-wordpress' ); $output .= '' . PHP_EOL; } else { $reason = __( 'Note: The site owner has disabled Google Analytics tracking for your user role.', 'google-analytics-for-wordpress' ); $output .= '' . PHP_EOL; } echo $output; // phpcs:ignore } ?> callbacks; // Sort by priority ksort( $callbacks ); foreach ( $callbacks as $priority => $priority_callbacks ) { foreach ( $priority_callbacks as $callback_key => $callback_data ) { // Capture output for this specific callback ob_start(); // Execute this specific callback if ( is_array( $callback_data['function'] ) ) { // Class method if ( is_object( $callback_data['function'][0] ) ) { call_user_func( $callback_data['function'] ); } else { // Static method call_user_func( $callback_data['function'] ); } } else { // Function call_user_func( $callback_data['function'] ); } $callback_output = ob_get_clean(); // Only create script tag if there's output if ( ! empty( trim( $callback_output ) ) ) { ?> request ) ) ); // phpcs:ignore if ( $referer = wp_get_referer() ) { $urls['page_referrer'] = $referer; } return wp_json_encode( $urls ); } /** * Check the server is among them who stripped utm parameters. * For this kind of server we will get page URL from JS. * * @return bool */ private function is_utm_stripped_server() { // Is WP Engine server. if ( isset( $_SERVER['IS_WPE'] ) && $_SERVER['IS_WPE'] ) { return true; } return apply_filters( 'monsterinsights_is_utm_stripped_server', false ); } }