Always load GA snippet when not in production
This commit is contained in:
@@ -92,13 +92,13 @@ function roots_google_analytics() { ?>
|
||||
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
|
||||
<?php else : ?>
|
||||
function ga() {
|
||||
console.log("GoogleAnalytics: " + [].slice.call(arguments));
|
||||
console.log('GoogleAnalytics: ' + [].slice.call(arguments));
|
||||
}
|
||||
<?php endif; ?>
|
||||
ga('create','<?php echo GOOGLE_ANALYTICS_ID; ?>','auto');ga('send','pageview');
|
||||
</script>
|
||||
|
||||
<?php }
|
||||
if (GOOGLE_ANALYTICS_ID && !current_user_can('manage_options')) {
|
||||
if (GOOGLE_ANALYTICS_ID && (WP_ENV !== 'production' || !current_user_can('manage_options'))) {
|
||||
add_action('wp_footer', 'roots_google_analytics', 20);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user