|
@@ -98,8 +98,8 @@ discard block |
|
|
block discarded – undo |
|
98
|
98
|
|
|
99
|
99
|
if ( $create && ! empty( $create ) && is_array( $create ) ) { |
|
100
|
100
|
$create = json_encode( $create ); |
|
101
|
|
- $create = str_replace( '"', "'", $create ); |
|
102
|
|
- $options['create'] = "'create', '" . esc_js( $ua_code ). "', '" . esc_js( $domain ) . "', " . $create; |
|
|
101
|
+ $create = str_replace( '"', "'", $create ); |
|
|
102
|
+ $options['create'] = "'create', '" . esc_js( $ua_code ) . "', '" . esc_js( $domain ) . "', " . $create; |
|
103
|
103
|
} else { |
|
104
|
104
|
$options['create'] = "'create', '" . esc_js( $ua_code ) . "', '" . esc_js( $domain ) . "'"; |
|
105
|
105
|
} |
|
@@ -175,34 +175,34 @@ discard block |
|
|
block discarded – undo |
|
175
|
175
|
*/ |
|
176
|
176
|
public function frontend_output( ) { |
|
177
|
177
|
$options = $this->frontend_tracking_options(); |
|
178
|
|
- $is_debug_mode = monsterinsights_is_debug_mode(); |
|
179
|
|
- $src = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics.js' ); |
|
|
178
|
+ $is_debug_mode = monsterinsights_is_debug_mode(); |
|
|
179
|
+ $src = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics.js' ); |
|
180
|
180
|
if ( current_user_can( 'manage_options' ) && $is_debug_mode ) { |
|
181
|
|
- $src = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics_debug.js' ); |
|
|
181
|
+ $src = apply_filters( 'monsterinsights_frontend_output_analytics_src', '//www.google-analytics.com/analytics_debug.js' ); |
|
182
|
182
|
} |
|
183
|
183
|
$compat = monsterinsights_get_option( 'gatracker_compatibility_mode', false ); |
|
184
|
|
- $compat = $compat ? 'window.ga = __gaTracker;' : ''; |
|
|
184
|
+ $compat = $compat ? 'window.ga = __gaTracker;' : ''; |
|
185
|
185
|
$track_user = monsterinsights_track_user(); |
|
186
|
186
|
$ua = monsterinsights_get_ua(); |
|
187
|
187
|
$output = ''; |
|
188
|
188
|
$reason = ''; |
|
189
|
|
- $cookie_notice = class_exists( 'Cookie_Notice' ) && monsterinsights_get_option( 'cookie_notice', false ); |
|
|
189
|
+ $cookie_notice = class_exists( 'Cookie_Notice' ) && monsterinsights_get_option( 'cookie_notice', false ); |
|
190
|
190
|
ob_start(); |
|
191
|
191
|
?> |
|
192
|
192
|
<!-- This site uses the Google Analytics by MonsterInsights plugin v<?php echo MONSTERINSIGHTS_VERSION; ?> - Using Analytics tracking - https://www.monsterinsights.com/ --> |
|
193
|
193
|
<?php if ( ! $track_user ) { |
|
194
|
194
|
if ( empty( $ua ) ) { |
|
195
|
195
|
$reason = __( 'Note: MonsterInsights is not currently configured on this site. The site owner needs to authenticate with Google Analytics in the MonsterInsights settings panel.', 'google-analytics-for-wordpress' ); |
|
196
|
|
- $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL; |
|
|
196
|
+ $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL; |
|
197
|
197
|
} else if ( current_user_can( 'monsterinsights_save_settings' ) ) { |
|
198
|
|
- $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' ); |
|
199
|
|
- $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL; |
|
|
198
|
+ $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' ); |
|
|
199
|
+ $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL; |
|
200
|
200
|
} else if ( class_exists( 'Cookie_Notice' ) ) { |
|
201
|
201
|
$reason = __( 'Note: You have not accepted the Cookie Notice.', 'google-analytics-for-wordpress' ); |
|
202
|
|
- $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL; |
|
|
202
|
+ $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL; |
|
203
|
203
|
} else { |
|
204
|
204
|
$reason = __( 'Note: The site owner has disabled Google Analytics tracking for your user role.', 'google-analytics-for-wordpress' ); |
|
205
|
|
- $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL; |
|
|
205
|
+ $output .= '<!-- ' . esc_html( $reason ) . ' -->' . PHP_EOL; |
|
206
|
206
|
} |
|
207
|
207
|
echo $output; |
|
208
|
208
|
} ?> |
|
@@ -265,7 +265,7 @@ discard block |
|
|
block discarded – undo |
|
265
|
265
|
?> |
|
266
|
266
|
} else { |
|
267
|
267
|
<?php if ( $this->should_do_optout() ) { ?> |
|
268
|
|
- console.log( "<?php echo esc_js( $reason );?>" ); |
|
|
268
|
+ console.log( "<?php echo esc_js( $reason ); ?>" ); |
|
269
|
269
|
(function() { |
|
270
|
270
|
/* https://developers.google.com/analytics/devguides/collection/analyticsjs/ */ |
|
271
|
271
|
var noopfn = function() { |
|
@@ -288,7 +288,7 @@ discard block |
|
|
block discarded – undo |
|
288
|
288
|
} |
|
289
|
289
|
var f = arguments[len-1]; |
|
290
|
290
|
if ( typeof f !== 'object' || f === null || typeof f.hitCallback !== 'function' ) { |
|
291
|
|
- console.log( '<?php echo esc_js( __('Not running function', 'google-analytics-for-wordpress' ) );?> __gaTracker(' + arguments[0] + " ....) <?php echo esc_js( sprintf( __( "because you're not being tracked. %s", 'google-analytics-for-wordpress' ), $reason ) );?>"); |
|
|
291
|
+ console.log( '<?php echo esc_js( __( 'Not running function', 'google-analytics-for-wordpress' ) ); ?> __gaTracker(' + arguments[0] + " ....) <?php echo esc_js( sprintf( __( "because you're not being tracked. %s", 'google-analytics-for-wordpress' ), $reason ) ); ?>"); |
|
292
|
292
|
return; |
|
293
|
293
|
} |
|
294
|
294
|
try { |