templates
2 months ago
ga-accounts-selector.php
2 months ago
ga-auth-button.php
2 months ago
ga-code.php
2 months ago
ga-dashboard-widget.php
2 months ago
ga-debug-modal.php
2 months ago
ga-ga4-settings.php
2 months ago
ga-googleanalytics-loader.php
2 months ago
ga-notice.php
2 months ago
ga-oauth-notice.php
2 months ago
ga-wp-notice.php
2 months ago
old-page.php
2 months ago
page.php
2 months ago
statistics.php
2 months ago
stats.php
2 months ago
trending.php
2 months ago
ga-code.php
40 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Code view. |
| 4 | * |
| 5 | * @package GoogleAnalytics |
| 6 | */ |
| 7 | |
| 8 | if (!defined('ABSPATH')) exit; |
| 9 | |
| 10 | $debug_mode_on = isset( $debug_mode_on ) ? $debug_mode_on : false; |
| 11 | |
| 12 | $script = ( true === $debug_mode_on ) ? |
| 13 | 'https://google-analytics.com/analytics_debug.js' : |
| 14 | 'https://google-analytics.com/analytics.js'; |
| 15 | ?> |
| 16 | <script> |
| 17 | (function() { |
| 18 | (function (i, s, o, g, r, a, m) { |
| 19 | i['GoogleAnalyticsObject'] = r; |
| 20 | i[r] = i[r] || function () { |
| 21 | (i[r].q = i[r].q || []).push(arguments) |
| 22 | }, i[r].l = 1 * new Date(); |
| 23 | a = s.createElement(o), |
| 24 | m = s.getElementsByTagName(o)[0]; |
| 25 | a.async = 1; |
| 26 | a.src = g; |
| 27 | m.parentNode.insertBefore(a, m) |
| 28 | })(window, document, 'script', '<?php echo esc_url( $script ); ?>', 'ga'); |
| 29 | |
| 30 | ga('create', '<?php echo esc_attr( $data[ Ga_Admin::GA_WEB_PROPERTY_ID_OPTION_NAME ] ); ?>', 'auto'); |
| 31 | <?php if ( 'on' === $data['anonymization'] ) : ?> |
| 32 | ga('set', 'anonymizeIp', true); |
| 33 | <?php endif; ?> |
| 34 | <?php if ( ! empty( $data['optimize'] ) ) : ?> |
| 35 | ga('require', '<?php echo esc_html( $data['optimize'] ); ?>' ); |
| 36 | <?php endif; ?> |
| 37 | ga('send', 'pageview'); |
| 38 | })(); |
| 39 | </script> |
| 40 |