Always load GA snippet when not in production

This commit is contained in:
QWp6t
2014-08-06 21:57:32 -07:00
parent dc0e838c2f
commit dd7635ced8

View File

@@ -92,13 +92,13 @@ function roots_google_analytics() { ?>
r.parentNode.insertBefore(e,r)}(window,document,'script','ga')); r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
<?php else : ?> <?php else : ?>
function ga() { function ga() {
console.log("GoogleAnalytics: " + [].slice.call(arguments)); console.log('GoogleAnalytics: ' + [].slice.call(arguments));
} }
<?php endif; ?> <?php endif; ?>
ga('create','<?php echo GOOGLE_ANALYTICS_ID; ?>','auto');ga('send','pageview'); ga('create','<?php echo GOOGLE_ANALYTICS_ID; ?>','auto');ga('send','pageview');
</script> </script>
<?php } <?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); add_action('wp_footer', 'roots_google_analytics', 20);
} }